From 5a570c89a58a999c5078162ae4de3cc708c7ade9 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 18 Nov 2025 09:10:03 +0000 Subject: [PATCH] Fix auto-registration token parsing and hostname --- install.sh | 2 +- internal/api/config_handlers.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index e73bb5a..8d1f2bd 100755 --- a/install.sh +++ b/install.sh @@ -1981,7 +1981,7 @@ PY fi 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 AUTO_NODE_REGISTER_ERROR="token value unavailable" print_warn "Failed to extract token value from pveum output; skipping automatic node registration" diff --git a/internal/api/config_handlers.go b/internal/api/config_handlers.go index da460e7..bc29d18 100644 --- a/internal/api/config_handlers.go +++ b/internal/api/config_handlers.go @@ -3879,8 +3879,8 @@ else # Only proceed with auto-registration if we have an auth token if [ -n "$AUTH_TOKEN" ]; then - # Get the server's hostname - SERVER_HOSTNAME=$(hostname -f 2>/dev/null || hostname) + # Get the server's hostname (short form to match Pulse node names) + SERVER_HOSTNAME=$(hostname -s 2>/dev/null || hostname) SERVER_IP=$(hostname -I | awk '{print $1}') # Send registration to Pulse @@ -5080,8 +5080,8 @@ else # Only proceed with auto-registration if we have an auth token if [ -n "$AUTH_TOKEN" ]; then - # Get the server's hostname - SERVER_HOSTNAME=$(hostname -f 2>/dev/null || hostname) + # Get the server's hostname (short form to match Pulse node names) + SERVER_HOSTNAME=$(hostname -s 2>/dev/null || hostname) SERVER_IP=$(hostname -I | awk '{print $1}') # Send registration to Pulse