diff options
author | helenyao <yaohelan@huawei.com> | 2016-11-21 06:50:06 -0500 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-11-24 15:14:45 +0100 |
commit | 3e3c96b2aa15d7757f281ce00518a67e2a1225a9 (patch) | |
tree | 9b15e0ceab33a9301ca7cde1a0a36e05f2347584 /functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py | |
parent | 7a776398ef8b17bd9af5367d712707a903c1c86a (diff) |
Extracted all global parameters into functest_constants.py
JIRA: FUNCTEST-533
1. Extracted all global variables into functest_constants.py and updated all affected areas accordingly
2. Used os.path.join to replace '/' to come up with the path for better cross-platform support and improve the path accuracy
3. Removed unused variables
4. Updated the hardcoded path in Dockerfile by using variable reference
5. Removed "/" ending from all path variables
6. Updated the unit test
Change-Id: Ib30a81d1f0c83fbaef042d63c187c27bd18301bb
Signed-off-by: helenyao <yaohelan@huawei.com>
Diffstat (limited to 'functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py')
-rwxr-xr-x | functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py b/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py index ca671d00..8e298d36 100755 --- a/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py +++ b/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py @@ -18,8 +18,12 @@ import functest.utils.functest_utils as ft_utils import functest.utils.functest_logger as ft_logger from run_tempest import configure_tempest from run_tempest import TEMPEST_RESULTS_DIR +import functest.utils.functest_constants as ft_constants -logger = ft_logger.Logger("multisite").getLogger() +logger = ft_logger.Logger("gen_tempest_conf").getLogger() + +CI_INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE +CI_INSTALLER_IP = ft_constants.CI_INSTALLER_IP def configure_tempest_multisite(deployment_dir): @@ -30,16 +34,16 @@ def configure_tempest_multisite(deployment_dir): configure_tempest(deployment_dir) logger.debug("Finding tempest.conf file...") - tempest_conf_file = deployment_dir + "/tempest.conf" - if not os.path.isfile(tempest_conf_file): + tempest_conf_old = os.path.join(deployment_dir, '/tempest.conf') + if not os.path.isfile(tempest_conf_old): logger.error("Tempest configuration file %s NOT found." - % tempest_conf_file) + % tempest_conf_old) exit(-1) # Copy tempest.conf to /home/opnfv/functest/results/tempest/ cur_path = os.path.split(os.path.realpath(__file__))[0] - shutil.copyfile(tempest_conf_file, cur_path + '/tempest_multisite.conf') - tempest_conf_file = cur_path + "/tempest_multisite.conf" + tempest_conf_file = os.path.join(cur_path, '/tempest_multisite.conf') + shutil.copyfile(tempest_conf_old, tempest_conf_file) logger.debug("Updating selected tempest.conf parameters...") config = ConfigParser.RawConfigParser() @@ -49,12 +53,12 @@ def configure_tempest_multisite(deployment_dir): cmd = "openstack endpoint show kingbird | grep publicurl |\ awk '{print $4}' | awk -F '/' '{print $4}'" kingbird_api_version = os.popen(cmd).read() - if os.environ.get("INSTALLER_TYPE") == 'fuel': + if CI_INSTALLER_TYPE == 'fuel': # For MOS based setup, the service is accessible # via bind host kingbird_conf_path = "/etc/kingbird/kingbird.conf" - installer_type = os.getenv('INSTALLER_TYPE', 'Unknown') - installer_ip = os.getenv('INSTALLER_IP', 'Unknown') + installer_type = CI_INSTALLER_TYPE + installer_ip = CI_INSTALLER_IP installer_username = ft_utils.get_functest_config( "multisite." + installer_type + "_environment.installer_username") |