Skip to content

Commit 22349b4

Browse files
authored
Merge pull request #449 from github/taz/fix-settings-restore-and-attributes
- restoring to an un-configured appliance fails due to a missing license file - subsequent arguments are ignored if the hostname of the restore target is specified first
2 parents c487d5a + dc367e7 commit 22349b4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

bin/ghe-restore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ while true; do
6262
exit 1
6363
;;
6464
*)
65-
break
65+
if [ -n "$1" ]; then
66+
GHE_RESTORE_HOST="$1"
67+
shift
68+
else
69+
break
70+
fi
6671
;;
6772
esac
6873
done
@@ -81,7 +86,7 @@ cleanup () {
8186
. "$( dirname "${BASH_SOURCE[0]}" )/../share/github-backup-utils/ghe-backup-config"
8287

8388
# Grab the host arg
84-
GHE_HOSTNAME="${1:-$GHE_RESTORE_HOST}"
89+
GHE_HOSTNAME="$GHE_RESTORE_HOST"
8590

8691
# Hostname without any port suffix
8792
hostname=$(echo "$GHE_HOSTNAME" | cut -f 1 -d :)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ ghe_remote_version_required "$GHE_HOSTNAME"
2525
# Path to snapshot dir we're restoring from
2626
GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"
2727

28+
echo "Restoring license ..."
29+
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-license' < "$GHE_RESTORE_SNAPSHOT_PATH/enterprise.ghl" 1>&3
30+
2831
echo "Restoring settings ..."
2932
# work around issue importing settings with bad storage mode values
3033
( cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" && echo ) |
3134
sed 's/"storage_mode": "device"/"storage_mode": "rootfs"/' |
3235
ghe-ssh "$GHE_HOSTNAME" -- '/usr/bin/env GHEBUVER=2 ghe-import-settings' 1>&3
3336

34-
echo "Restoring license ..."
35-
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-license' < "$GHE_RESTORE_SNAPSHOT_PATH/enterprise.ghl" 1>&3
36-
3737
# Restore management console password hash if present.
3838
if [ -f "$GHE_RESTORE_SNAPSHOT_PATH/manage-password" ]; then
3939
echo "Restoring management console password ..."

0 commit comments

Comments
 (0)