Skip to content

Commit 6396e77

Browse files
committed
log error msg when any node is offline
1 parent 0007359 commit 6396e77

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

bin/ghe-backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ if [ -z "$failures" ]; then
375375
else
376376
log_info "Expired and incomplete snapshots to be pruned separately"
377377
fi
378-
else
378+
else
379379
log_info "Skipping pruning snapshots, since some backups failed..."
380380
fi
381381

bin/ghe-host-check

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

94+
set +e
9495
# ensure all nodes in the cluster are online/reachable and running the same version
9596
if "$CLUSTER"; then
9697
online_status=$(ghe-ssh "$host" ghe-cluster-host-check)
9798
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+
echo "$online_status" 1>&2
100+
log_error "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2
99101
exit 1
100102
fi
101103

102104
node_version_list=$(ghe-ssh "$host" ghe-cluster-each -- ghe-version)
103105
distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l)
104106
if [ "$distinct_versions" -ne 1 ]; then
105107
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
108+
log_error "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2
107109
exit 1
108110
fi
109111
fi
112+
set -e
110113

111114
version=$(echo "$output" | grep "GitHub Enterprise" | awk '{print $NF}')
112115

@@ -177,7 +180,7 @@ SKIP_MSG
177180

178181
#Display dir requirements for repositories and mysql
179182
echo -e "\nChecking host for sufficient space for a backup..."
180-
available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}')
183+
available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}')
181184
echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time."
182185

183186
repos_disk_size=$(transfer_size repositories /tmp)

share/github-backup-utils/ghe-backup-config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ init-progress() {
667667

668668
mkdir -p /tmp/backup-utils-progress
669669
chmod -R 777 /tmp/backup-utils-progress
670-
670+
671671
touch /tmp/backup-utils-progress/total
672672
touch /tmp/backup-utils-progress/type
673673
touch /tmp/backup-utils-progress/progress

0 commit comments

Comments
 (0)