fix: filter out qdevice from cluster node discovery
This commit is contained in:
parent
ea8ae63d70
commit
9fdea3c9cd
3 changed files with 7 additions and 4 deletions
|
|
@ -740,6 +740,9 @@ func parseClusterNodes(output string) ([]string, error) {
|
||||||
var nodes []string
|
var nodes []string
|
||||||
lines := strings.Split(output, "\n")
|
lines := strings.Split(output, "\n")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
|
if strings.Contains(strings.ToLower(line), "qdevice") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
fields := strings.Fields(line)
|
fields := strings.Fields(line)
|
||||||
// Need at least 2 fields to be a valid node line (id + ip/name)
|
// Need at least 2 fields to be a valid node line (id + ip/name)
|
||||||
if len(fields) < 2 {
|
if len(fields) < 2 {
|
||||||
|
|
|
||||||
|
|
@ -805,7 +805,7 @@ cleanup_cluster_authorized_keys_manual() {
|
||||||
if command -v pvecm >/dev/null 2>&1; then
|
if command -v pvecm >/dev/null 2>&1; then
|
||||||
while IFS= read -r node_ip; do
|
while IFS= read -r node_ip; do
|
||||||
[[ -n "$node_ip" ]] && nodes+=("$node_ip")
|
[[ -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
|
fi
|
||||||
|
|
||||||
if [[ ${#nodes[@]} -eq 0 ]]; then
|
if [[ ${#nodes[@]} -eq 0 ]]; then
|
||||||
|
|
@ -2646,7 +2646,7 @@ if [[ -z "$HOST" ]]; then
|
||||||
|
|
||||||
# Discover cluster nodes
|
# Discover cluster nodes
|
||||||
if command -v pvecm >/dev/null 2>&1; then
|
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
|
if [[ -n "$CLUSTER_NODES" ]]; then
|
||||||
for node_ip in $CLUSTER_NODES; do
|
for node_ip in $CLUSTER_NODES; do
|
||||||
|
|
@ -2955,7 +2955,7 @@ print_info "Proxy public key: ${PROXY_PUBLIC_KEY:0:50}..."
|
||||||
# Discover cluster nodes
|
# Discover cluster nodes
|
||||||
if command -v pvecm >/dev/null 2>&1; then
|
if command -v pvecm >/dev/null 2>&1; then
|
||||||
# Extract node IPs from pvecm status
|
# 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
|
if [[ -n "$CLUSTER_NODES" ]]; then
|
||||||
print_info "Discovered cluster nodes: $(echo $CLUSTER_NODES | tr '\n' ' ')"
|
print_info "Discovered cluster nodes: $(echo $CLUSTER_NODES | tr '\n' ' ')"
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ if [[ -z "$HOST" ]]; then
|
||||||
|
|
||||||
# Discover cluster nodes
|
# Discover cluster nodes
|
||||||
if command -v pvecm >/dev/null 2>&1; then
|
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
|
if [[ -n "$CLUSTER_NODES" ]]; then
|
||||||
for node_ip in $CLUSTER_NODES; do
|
for node_ip in $CLUSTER_NODES; do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue