Skip to content

Commit 33efc37

Browse files
committed
move logic around for binary backups only
1 parent a32b235 commit 33efc37

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

share/github-backup-utils/ghe-restore-mysql

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ is_binary_backup_feature_on(){
3939
}
4040

4141
ssh_config_file_opt=
42-
if $CLUSTER ; then
43-
ghe_mysql_master=$(ghe-ssh "$GHE_HOSTNAME" ghe-config "cluster.mysql-master")
44-
if [ -z $ghe_mysql_master ]; then
45-
echo "Something is wrong with configuration: cluster.mysql-master not found" >&2
46-
exit 2
47-
else
48-
tempdir=$(mktemp -d -t backup-utils-restore-XXXXXX)
49-
ssh_config_file="$tempdir/ssh_config"
50-
ssh_config_file_opt="-F $ssh_config_file"
51-
ghe-ssh-config "$GHE_HOSTNAME" "$ghe_mysql_master" > "$ssh_config_file"
52-
port=$(ssh_port_part "$GHE_HOSTNAME")
53-
ghe_mysql_master=$ghe_mysql_master${port:+:$port}
54-
fi
55-
else
56-
ghe_mysql_master=$GHE_HOSTNAME
57-
fi
58-
5942
if is_binary_backup_feature_on; then
6043
# Feature "mysql.backup.binary" is on, which means new backup scripts are available
6144
if is_binary_backup; then
45+
if $CLUSTER ; then
46+
ghe_mysql_master=$(ghe-ssh "$GHE_HOSTNAME" ghe-config "cluster.mysql-master")
47+
if [ -z $ghe_mysql_master ]; then
48+
echo "Something is wrong with configuration: cluster.mysql-master not found" >&2
49+
exit 2
50+
else
51+
tempdir=$(mktemp -d -t backup-utils-restore-XXXXXX)
52+
ssh_config_file="$tempdir/ssh_config"
53+
ssh_config_file_opt="-F $ssh_config_file"
54+
ghe-ssh-config "$GHE_HOSTNAME" "$ghe_mysql_master" > "$ssh_config_file"
55+
port=$(ssh_port_part "$GHE_HOSTNAME")
56+
ghe_mysql_master=$ghe_mysql_master${port:+:$port}
57+
fi
58+
else
59+
ghe_mysql_master=$GHE_HOSTNAME
60+
fi
61+
6262
# Check if the decompress needed by looking into the sentinel file
6363
# In 2.19.5 we compress the binary backup twice
6464
if [ "$(cat $snapshot_dir/mysql-binary-backup-sentinel)" = "NO_ADDITIONAL_COMPRESSION" ]; then

0 commit comments

Comments
 (0)