aboutsummaryrefslogtreecommitdiffstats
path: root/functest/ci/prepare_env.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/ci/prepare_env.py')
-rwxr-xr-xfunctest/ci/prepare_env.py44
1 files changed, 10 insertions, 34 deletions
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index e03bc654..9e53e30b 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -83,11 +83,9 @@ def check_env_variables():
% CONST.__getattribute__('INSTALLER_TYPE'))
if CONST.__getattribute__('INSTALLER_IP') is None:
- logger.warning("The env variable 'INSTALLER_IP' is not defined. "
- "It is needed to fetch the OpenStack credentials. "
- "If the credentials are not provided to the "
- "container as a volume, please add this env variable "
- "to the 'docker run' command.")
+ logger.warning(
+ "The env variable 'INSTALLER_IP' is not defined. It is recommended"
+ " to extract some information from the deployment")
else:
logger.info(" INSTALLER_IP=%s" %
CONST.__getattribute__('INSTALLER_IP'))
@@ -177,7 +175,6 @@ def create_directories():
def source_rc_file():
print_separator()
- logger.info("Fetching RC file...")
if CONST.__getattribute__('openstack_creds') is None:
logger.warning("The environment variable 'creds' must be set and"
@@ -187,38 +184,17 @@ def source_rc_file():
CONST.__getattribute__('dir_functest_conf'), 'openstack.creds')
if not os.path.isfile(CONST.__getattribute__('openstack_creds')):
- logger.info("RC file not provided. "
- "Fetching it from the installer...")
- if CONST.__getattribute__('INSTALLER_IP')is None:
- logger.error("The env variable 'INSTALLER_IP' must be provided in"
- " order to fetch the credentials from the installer.")
- raise Exception("Missing CI_INSTALLER_IP.")
- if (CONST.__getattribute__('INSTALLER_TYPE') not in
- opnfv_constants.INSTALLERS):
- logger.error("Cannot fetch credentials. INSTALLER_TYPE=%s is "
- "not a valid OPNFV installer. Available "
- "installers are : %s." %
- (CONST.__getattribute__('INSTALLER_TYPE'),
- opnfv_constants.INSTALLERS))
- raise Exception("Wrong INSTALLER_TYPE.")
-
- cmd = ("/home/opnfv/repos/releng/utils/fetch_os_creds.sh "
- "-d %s -i %s -a %s"
- % (CONST.__getattribute__('openstack_creds'),
- CONST.__getattribute__('INSTALLER_TYPE'),
- CONST.__getattribute__('INSTALLER_IP')))
- logger.debug("Executing command: %s" % cmd)
- p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
- output = p.communicate()[0]
- logger.debug("\n%s" % output)
- if p.returncode != 0:
- raise Exception("Failed to fetch credentials from installer.")
+ raise Exception(
+ "OpenStack credentials file not provided. "
+ "The OpenStack credentials must be in {}"
+ .format(CONST.__getattribute__('openstack_creds')))
else:
logger.info("RC file provided in %s."
% CONST.__getattribute__('openstack_creds'))
if os.path.getsize(CONST.__getattribute__('openstack_creds')) == 0:
- raise Exception("The file %s is empty." %
- CONST.__getattribute__('openstack_creds'))
+ raise Exception(
+ "The OpenStack RC file {} is empty."
+ .format(CONST.__getattribute__('openstack_creds')))
logger.info("Sourcing the OpenStack RC file...")
os_utils.source_credentials(CONST.__getattribute__('openstack_creds'))