summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-31 16:08:01 -0700
committerelijah <elijah@riseup.net>2016-08-31 16:08:01 -0700
commit512e104b8249305ee3e34a283b9b5f94af795cd2 (patch)
treeeeea2da878934dcf3a47cfc24a3856a5b2f9d69e
parente8b614abd7850b8359930087d84b21515c970a71 (diff)
removes hard coded paths and relies entirely on the following required environment variables: LEAP_CMD TAG PROVIDERDIR LOGDIR LOCKDIR
-rwxr-xr-xleap-platform-test49
1 files changed, 16 insertions, 33 deletions
diff --git a/leap-platform-test b/leap-platform-test
index bbe7b85..cf03b8b 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -51,7 +51,7 @@ add_nodes() {
ip="${IP_PREFIX}.$suffix"
if [[ "$services" =~ "openvpn" ]]
- then
+ then
config="openvpn.gateway_address:${IP_PREFIX}.98 openvpn.second_gateway_address:${IP_PREFIX}.99"
else
config=''
@@ -146,7 +146,6 @@ create_provider() {
$LEAP_CMD $OPTS cert ca && $LEAP_CMD $OPTS cert csr
# copy for faster testing
- #cp $ROOTDIR/dh.pem.test $PROVIDERDIR/files/ca/dh.pem
$LEAP_CMD $OPTS cert dh
add_nodes $NODES
@@ -552,28 +551,25 @@ do
shift
done
-
cmd=$1
shift
-
-# common config for all providers
-source "./tests/puppet/provider/.platform-test.conf"
-
-# custom user config
+# source custom user config
source ~/.config/leap/platform_ci/.platform-test.conf &> /dev/null || /bin/true
-if [ ! -z "$config" ]
-then
- # source provider specific config
- source "$config"
+# source --config
+if [ ! -z "$config" ]; then
+ source "$config"
fi
-if [ -z "$TAG" ]
-then
- echo "Please specify a TAG to deploy."
- exit 1
-fi
+# check requirements
+REQUIRED_ENV="LEAP_CMD TAG PROVIDERDIR LOGDIR LOCKDIR"
+for env in $REQUIRED_ENV; do
+ if [ -z "${!env}" ]; then
+ echo "Environment variable \$${!env} is required."
+ exit 1
+ fi
+done
date=$( date +"%F-%H%M%S" )
LOG_GLOBAL="$LOGDIR/deploy-$date.log"
@@ -582,14 +578,11 @@ ERRLOG_GLOBAL="$LOGDIR/deploy-$date-error.log"
TEST_LOG1="$LOGDIR/test.log"
TEST_LOG2="$LOGDIR/test-$date.log"
-LOCKFILE_DIR="$ROOTDIR/builds/lock"
-[ -e "$LOCKFILE_DIR" ] || mkdir -p "$LOCKFILE_DIR"
-LOCKFILE="${LOCKFILE_DIR}/$(basename $0).lock"
-FAILURE_LOCKFILE="${LOCKFILE_DIR}/failure.lock"
+[ -e "$LOCKDIR" ] || mkdir -p "$LOCKDIR"
+LOCKFILE="${LOCKDIR}/$(basename $0).lock"
+FAILURE_LOCKFILE="${LOCKDIR}/failure.lock"
exitcode=0
-
-
[ -e "$PROVIDERDIR" ] && cd "$PROVIDERDIR"
if $print_versions
@@ -600,21 +593,11 @@ then
exit 0
fi
-if [ -z "$LEAP_CMD" ]
-then
- echo "please provide a path to the leap_cli binary using the LEAP_CMD var."
- exit 1
-fi
-
check_for_running_instances || exit $?
# set global lockfile
touch "$LOCKFILE"
-echo "@platform_directory_path = \"${ROOTDIR}\"" > ${PROVIDERDIR}/Leapfile
-echo "leap_platform is at: ${ROOTDIR}"
-echo "provider config is at: ${PROVIDERDIR}"
-
nodes=$($LEAP_CMD list $TAG --print= | sed "s/ //g")
case $cmd in