From 0030d1a79c8221c5f0d4cc3270037bb15ec535e0 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Wed, 25 Nov 2015 17:34:52 +0100 Subject: Don't check for env variables if openstack credentials are given JIRA: FUNCTEST-100 Change-Id: Ibef44cf00ec2a2b0ff5bfe21465918ff86bfc589 Signed-off-by: jose.lausuch --- docker/prepare_env.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh index b630c37f3..3353a342c 100755 --- a/docker/prepare_env.sh +++ b/docker/prepare_env.sh @@ -56,21 +56,26 @@ else info "MODE: offline" fi +# definition of available installer names +INSTALLERS=(fuel foreman compass apex joid) -# Check if environment variables are set -info "Checking environment variables INSTALLER_TYPE and INSTALLER_IP" -if [ -z ${INSTALLER_TYPE} ]; then - error "Environment variable 'INSTALLER_TYPE' is not defined." -elif [[ ${INSTALLER_TYPE} =~ ^(fuel|foreman|compass|apex|joid)$ ]]; then - info "INSTALLER_TYPE env variable found: ${INSTALLER_TYPE}" -else - error "Invalid environment variable INSTALLER_TYPE=${INSTALLER_TYPE}" -fi +if [ ! -f ${FUNCTEST_CONF_DIR}/openstack.creds ]; then + # If credentials file is not given, check if environment variables are set + # to get the creds using fetch_os_creds.sh later on + info "Checking environment variables INSTALLER_TYPE and INSTALLER_IP" + if [ -z ${INSTALLER_TYPE} ]; then + error "Environment variable 'INSTALLER_TYPE' is not defined." + elif [[ ${INSTALLERS[@]} =~ ${INSTALLER_TYPE} ]]; then + info "INSTALLER_TYPE env variable found: ${INSTALLER_TYPE}" + else + error "Invalid environment variable INSTALLER_TYPE=${INSTALLER_TYPE}" + fi -if [ -z ${INSTALLER_IP} ]; then - error "Environment variable 'INSTALLER_IP' is not defined." + if [ -z ${INSTALLER_IP} ]; then + error "Environment variable 'INSTALLER_IP' is not defined." + fi + info "INSTALLER_IP env variable found: ${INSTALLER_IP}" fi -info "INSTALLER_IP env variable found: ${INSTALLER_IP}" if [ $offline == false ]; then -- cgit 1.2.3-korg