Skip to content

Commit 19e43b6

Browse files
authored
Merge pull request #418 from github/enterprise-3.8-backport-348-users/boxofyellow/2023-06/mssql-backup_0
Backport 348 for 3.8: Allow the caller to handle setting failures
2 parents c9a416d + e1ed9b0 commit 19e43b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

share/github-backup-utils/ghe-backup-mssql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ export_tool_available() {
3030
}
3131

3232
ghe_ssh_mssql() {
33-
ghe-ssh $opts $ssh_config_file_opt "$GHE_MSSQL_PRIMARY_HOST" "$@"
33+
ghe-ssh "${opts[@]}" "${ssh_config_file_opt[@]}" "$GHE_MSSQL_PRIMARY_HOST" "$@"
3434
}
3535

3636
cleanup() {
37-
rm -rf $tempdir
37+
rm -rf "$tempdir"
3838
}
3939
trap 'cleanup' EXIT INT
4040

@@ -55,8 +55,8 @@ isHA="$(ghe-ssh "$GHE_HOSTNAME" -- "ghe-config cluster.ha" || true)"
5555
# get server hostnames under cluster and HA
5656
if [ "$GHE_BACKUP_STRATEGY" = "cluster" ] || [ "$isHA" = "true" ] ; then
5757
ssh_config_file="$tempdir/ssh_config"
58-
ssh_config_file_opt="-F $ssh_config_file"
59-
opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
58+
ssh_config_file_opt=("-F" "$ssh_config_file")
59+
opts=("-o" "UserKnownHostsFile=/dev/null" "-o" "StrictHostKeyChecking=no" "-o" "PasswordAuthentication=no")
6060
ghe-ssh-config "$GHE_HOSTNAME" "$GHE_MSSQL_PRIMARY_HOST" > "$ssh_config_file"
6161
fi
6262

@@ -69,10 +69,10 @@ add_minute() {
6969
# Expect date string in the format of yyyymmddTHHMMSS
7070
# Here parse date differently depending on GNU Linux vs BSD MacOS
7171
if date -v -1d > /dev/null 2>&1; then
72-
echo "$(date -v +$2M -ujf'%Y%m%dT%H%M%S' $1 +%Y%m%dT%H%M%S)"
72+
date -v +"$2"M -ujf'%Y%m%dT%H%M%S' "$1" +%Y%m%dT%H%M%S
7373
else
7474
dt=$1
75-
echo "$(date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes")"
75+
date -u '+%Y%m%dT%H%M%S' -d "${dt:0:8} ${dt:9:2}:${dt:11:2}:${dt:13:2} $2 minutes"
7676
fi
7777
}
7878

@@ -337,7 +337,7 @@ if [ -n "$backup_type" ]; then
337337
fi
338338

339339
bm_start "$(basename "$0")"
340-
ghe_ssh_mssql -- "$backup_command" || failures="$failures mssql"
340+
ghe_ssh_mssql -- "$backup_command"
341341
bm_end "$(basename "$0")"
342342

343343
# Configure the backup cadence on the appliance, which is used for diagnostics

0 commit comments

Comments
 (0)