File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,13 @@ if ghe-ssh "$GHE_HOSTNAME" -- \
105
105
restore_settings=false
106
106
fi
107
107
108
+ # Restoring a cluster backup to a standalone appliance is not supported
109
+ if ! $cluster && [ " $GHE_BACKUP_STRATEGY " = " cluster" ]; then
110
+ echo " Error: Snapshot from a GitHub Enterprise cluster cannot be restored" \
111
+ " to a standalone appliance. Aborting." >&2
112
+ exit 1
113
+ fi
114
+
108
115
# Figure out if we're restoring into a cluster with an unsupported snapshot
109
116
if $cluster ; then
110
117
snapshot_instance_version=$( cat $GHE_RESTORE_SNAPSHOT_PATH /version)
Original file line number Diff line number Diff line change @@ -484,3 +484,30 @@ begin_test "ghe-restore with tarball strategy"
484
484
echo " $output " | grep -q ' fake ghe-export-repositories data'
485
485
)
486
486
end_test
487
+
488
+ begin_test " ghe-restore cluster backup to non-cluster appliance"
489
+ (
490
+ set -e
491
+ rm -rf " $GHE_REMOTE_ROOT_DIR "
492
+ setup_remote_metadata
493
+
494
+ # create file used to determine if instance has been configured.
495
+ if [ " $GHE_VERSION_MAJOR " -le 1 ]; then
496
+ touch " $GHE_REMOTE_DATA_DIR /enterprise/dna.json"
497
+ else
498
+ touch " $GHE_REMOTE_ROOT_DIR /etc/github/configured"
499
+ fi
500
+
501
+ # create file used to determine if instance is in maintenance mode.
502
+ mkdir -p " $GHE_REMOTE_DATA_DIR /github/current/public/system"
503
+ touch " $GHE_REMOTE_DATA_DIR /github/current/public/system/maintenance.html"
504
+
505
+ # Create fake remote repositories dir
506
+ mkdir -p " $GHE_REMOTE_DATA_USER_DIR /repositories"
507
+
508
+ echo " cluster" > " $GHE_DATA_DIR /current/strategy"
509
+ ! output=$( ghe-restore -v -f localhost 2>&1 )
510
+
511
+ echo $output | grep -q " Snapshot from a GitHub Enterprise cluster cannot be restored"
512
+ )
513
+ end_test
You can’t perform that action at this time.
0 commit comments