Skip to content

Commit e52e0a7

Browse files
authored
Merge pull request #572 from github/enterprise-3.7-backport-492-add-host-online-check
Backport 492 for 3.7: Adding host online check
2 parents fe4baf6 + 36c5d07 commit e52e0a7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

bin/ghe-host-check

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,18 @@ 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
105+
echo "Version mismatch: $node_version_list" 1>&2
100106
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

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)