diff options
author | 2017-06-06 13:36:06 +0000 | |
---|---|---|
committer | 2017-06-06 13:36:06 +0000 | |
commit | 6c6b03b310cf60b251a52127901431f7d059e45f (patch) | |
tree | a0af3097253a14de0052266e45adaa73b0c752d6 /functest/ci | |
parent | 5e9320777016b10685b7edeecfd2b6d0f1ffabbe (diff) | |
parent | 81e3719bce31a74b027e5ba97b5b89d76e133e5e (diff) |
Merge "Remove call to fetch_os_creds.sh"
Diffstat (limited to 'functest/ci')
-rwxr-xr-x | functest/ci/prepare_env.py | 44 |
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')) |