Fix auto-registration token parsing and hostname
This commit is contained in:
parent
f7261f3080
commit
5a570c89a5
2 changed files with 5 additions and 5 deletions
|
|
@ -1981,7 +1981,7 @@ PY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local token_value
|
local token_value
|
||||||
token_value=$(echo "$token_output" | grep -E "│[[:space:]]*value" | awk -F'│' '{print $3}' | tr -d '[:space:]' | tail -n1)
|
token_value=$(awk -F'│' '/[[:space:]]value[[:space:]]/{col=$3; gsub(/^[[:space:]]+|[[:space:]]+$/, "", col); print col}' <<<"$token_output" | tail -n1 | tr -d '\r')
|
||||||
if [[ -z "$token_value" ]]; then
|
if [[ -z "$token_value" ]]; then
|
||||||
AUTO_NODE_REGISTER_ERROR="token value unavailable"
|
AUTO_NODE_REGISTER_ERROR="token value unavailable"
|
||||||
print_warn "Failed to extract token value from pveum output; skipping automatic node registration"
|
print_warn "Failed to extract token value from pveum output; skipping automatic node registration"
|
||||||
|
|
|
||||||
|
|
@ -3879,8 +3879,8 @@ else
|
||||||
|
|
||||||
# Only proceed with auto-registration if we have an auth token
|
# Only proceed with auto-registration if we have an auth token
|
||||||
if [ -n "$AUTH_TOKEN" ]; then
|
if [ -n "$AUTH_TOKEN" ]; then
|
||||||
# Get the server's hostname
|
# Get the server's hostname (short form to match Pulse node names)
|
||||||
SERVER_HOSTNAME=$(hostname -f 2>/dev/null || hostname)
|
SERVER_HOSTNAME=$(hostname -s 2>/dev/null || hostname)
|
||||||
SERVER_IP=$(hostname -I | awk '{print $1}')
|
SERVER_IP=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
# Send registration to Pulse
|
# Send registration to Pulse
|
||||||
|
|
@ -5080,8 +5080,8 @@ else
|
||||||
|
|
||||||
# Only proceed with auto-registration if we have an auth token
|
# Only proceed with auto-registration if we have an auth token
|
||||||
if [ -n "$AUTH_TOKEN" ]; then
|
if [ -n "$AUTH_TOKEN" ]; then
|
||||||
# Get the server's hostname
|
# Get the server's hostname (short form to match Pulse node names)
|
||||||
SERVER_HOSTNAME=$(hostname -f 2>/dev/null || hostname)
|
SERVER_HOSTNAME=$(hostname -s 2>/dev/null || hostname)
|
||||||
SERVER_IP=$(hostname -I | awk '{print $1}')
|
SERVER_IP=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
# Send registration to Pulse
|
# Send registration to Pulse
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue