From 9fdea3c9cd1f12e43eb7313b9e94a2dd53eac060 Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Mon, 24 Nov 2025 22:54:58 +0000 Subject: [PATCH] fix: filter out qdevice from cluster node discovery --- cmd/pulse-sensor-proxy/ssh.go | 3 +++ scripts/install-sensor-proxy.sh | 6 +++--- scripts/pulse-sensor-cleanup.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/pulse-sensor-proxy/ssh.go b/cmd/pulse-sensor-proxy/ssh.go index b027af9..340e17a 100644 --- a/cmd/pulse-sensor-proxy/ssh.go +++ b/cmd/pulse-sensor-proxy/ssh.go @@ -740,6 +740,9 @@ func parseClusterNodes(output string) ([]string, error) { var nodes []string lines := strings.Split(output, "\n") for _, line := range lines { + if strings.Contains(strings.ToLower(line), "qdevice") { + continue + } fields := strings.Fields(line) // Need at least 2 fields to be a valid node line (id + ip/name) if len(fields) < 2 { diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.sh index ffa34b4..ae17987 100755 --- a/scripts/install-sensor-proxy.sh +++ b/scripts/install-sensor-proxy.sh @@ -805,7 +805,7 @@ cleanup_cluster_authorized_keys_manual() { if command -v pvecm >/dev/null 2>&1; then while IFS= read -r node_ip; do [[ -n "$node_ip" ]] && nodes+=("$node_ip") - done < <(pvecm status 2>/dev/null | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) + done < <(pvecm status 2>/dev/null | grep -vEi "qdevice" | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) fi if [[ ${#nodes[@]} -eq 0 ]]; then @@ -2646,7 +2646,7 @@ if [[ -z "$HOST" ]]; then # Discover cluster nodes if command -v pvecm >/dev/null 2>&1; then - CLUSTER_NODES=$(pvecm status 2>/dev/null | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) + CLUSTER_NODES=$(pvecm status 2>/dev/null | grep -vEi "qdevice" | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) if [[ -n "$CLUSTER_NODES" ]]; then for node_ip in $CLUSTER_NODES; do @@ -2955,7 +2955,7 @@ print_info "Proxy public key: ${PROXY_PUBLIC_KEY:0:50}..." # Discover cluster nodes if command -v pvecm >/dev/null 2>&1; then # Extract node IPs from pvecm status - CLUSTER_NODES=$(pvecm status 2>/dev/null | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) + CLUSTER_NODES=$(pvecm status 2>/dev/null | grep -vEi "qdevice" | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) if [[ -n "$CLUSTER_NODES" ]]; then print_info "Discovered cluster nodes: $(echo $CLUSTER_NODES | tr '\n' ' ')" diff --git a/scripts/pulse-sensor-cleanup.sh b/scripts/pulse-sensor-cleanup.sh index 1947b29..c6d831a 100755 --- a/scripts/pulse-sensor-cleanup.sh +++ b/scripts/pulse-sensor-cleanup.sh @@ -64,7 +64,7 @@ if [[ -z "$HOST" ]]; then # Discover cluster nodes if command -v pvecm >/dev/null 2>&1; then - CLUSTER_NODES=$(pvecm status 2>/dev/null | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) + CLUSTER_NODES=$(pvecm status 2>/dev/null | grep -vEi "qdevice" | awk '/0x[0-9a-f]+.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) print $i}' || true) if [[ -n "$CLUSTER_NODES" ]]; then for node_ip in $CLUSTER_NODES; do