File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
share/github-backup-utils Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,18 @@ if [ ${GHE_DATA_DIR:0:1} != "/" ]; then
8383 GHE_DATA_DIR=" $( cd " $GHE_BACKUP_ROOT " && readlink -m " $GHE_DATA_DIR " 2> /dev/null || echo " $GHE_BACKUP_ROOT /$GHE_DATA_DIR " ) "
8484fi
8585
86+ # Assign the Release File path if it hasn't been provided (eg: by test suite)
87+ : ${GHE_RELEASE_FILE:= " /etc/github/enterprise-release" }
88+
89+ # Check that utils are not being run directly on GHE appliance.
90+ if [ -f " $GHE_RELEASE_FILE " ]; then
91+ echo " Error: Backup Utils cannot be run on the GitHub Enterprise host." 1>&2
92+ echo " The backup utilities should be run on a host dedicated to" 1>&2
93+ echo " long-term permanent storage and must have network connectivity" 1>&2
94+ echo " with the GitHub Enterprise appliance." 1>&2
95+ exit 1
96+ fi
97+
8698GHE_CREATE_DATA_DIR=${GHE_CREATE_DATA_DIR:- yes}
8799
88100# Check that the data directory is set and create it if it doesn't exist.
Original file line number Diff line number Diff line change @@ -41,6 +41,26 @@ begin_test "ghe-backup-config GHE_CREATE_DATA_DIR disabled"
4141)
4242end_test
4343
44+ begin_test " ghe-backup-config run on GHE appliance"
45+ (
46+ set -e
47+
48+ export GHE_RELEASE_FILE=" $TRASHDIR /enterprise-release"
49+ touch " $GHE_RELEASE_FILE "
50+ set +e
51+ error=$( . share/github-backup-utils/ghe-backup-config 2>&1 )
52+ # should exit 1
53+ if [ $? != 1 ]; then
54+ exit 1
55+ fi
56+ set -e
57+ echo " $error " | grep -q " Error: Backup Utils cannot be run on the GitHub Enterprise host."
58+
59+ test -f " $GHE_RELEASE_FILE "
60+ rm -rf " $GHE_RELEASE_FILE "
61+ )
62+ end_test
63+
4464begin_test " ghe-backup-config ssh_host_part"
4565(
4666 set -e
@@ -51,7 +71,6 @@ begin_test "ghe-backup-config ssh_host_part"
5171)
5272end_test
5373
54-
5574begin_test " ghe-backup-config ssh_port_part"
5675(
5776 set -e
You can’t perform that action at this time.
0 commit comments