Skip to content

Commit 7c380a8

Browse files
tonytrgchuckp22
authored andcommitted
Adding host online check (#492)
* adding host online check * fix test --------- Co-authored-by: Chuck Pathanjali <[email protected]>
1 parent 3329376 commit 7c380a8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

bin/ghe-host-check

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,19 @@ if ghe-ssh "$host" -- \
9191
CLUSTER=true
9292
fi
9393

94-
# ensure all nodes in the cluster are running the same version
94+
# ensure all nodes in the cluster are online/reachable and running the same version
9595
if "$CLUSTER"; then
96+
online_status=$(ghe-ssh "$host" ghe-cluster-host-check)
97+
if [ "$online_status" != "Cluster is ready to configure." ]; then
98+
echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2
99+
exit 1
100+
fi
101+
96102
node_version_list=$(ghe-ssh "$host" ghe-cluster-each -- ghe-version)
97103
distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l)
98104
if [ "$distinct_versions" -ne 1 ]; then
99-
echo "$node_version_list" 1>&2
100-
echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&3
105+
echo "Version mismatch: $node_version_list" 1>&2
106+
echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2
101107
exit 1
102108
fi
103109
fi

test/bin/ghe-cluster-host-check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# Usage: ghe-cluster-host-check
3+
# Emulates a cluster reachability check
4+
set -e
5+
echo "Cluster is ready to configure."

0 commit comments

Comments
 (0)