influx upgrade

This commit is contained in:
Jason Ertel
2023-02-09 18:27:14 -05:00
parent 0e50d36da6
commit 0eec8b22a2
4 changed files with 7 additions and 2 deletions

View File

@@ -36,10 +36,12 @@ log() {
read_password() {
# Read password for new user from stdin
set +e
test -t 0
if [[ $? == 0 ]]; then
echo "Enter new password:"
fi
set -e
read -rs USER_PASS
check_password_and_exit "$USER_PASS"
@@ -49,6 +51,7 @@ check_response() {
response=$1
if [[ "$response" =~ "\"code\":" ]]; then
log "Failed. Check the response for more details.\n$response"
exit 1
fi
}
@@ -61,6 +64,7 @@ if [[ "$OP" == "add" ]]; then
OP=password
fi
log "Looking up user ID"
response=$(curl -sk https://localhost:8086/api/v2/users?limit=100 -H "Authorization: Token $TOKEN")
check_response "$response"
USER_ID=$(echo "$response" | jq -r ".users[] | select(.name == \"$USER_EMAIL\").id")