diff options
author | boucherv <valentin.boucher@orange.com> | 2016-08-10 18:59:41 +0200 |
---|---|---|
committer | boucherv <valentin.boucher@orange.com> | 2016-08-10 19:06:19 +0200 |
commit | 7eefbe8f7ec52d727e8e504e4ddd4ddb57cf569e (patch) | |
tree | 5b1b61bbe68c03a74397dbdbf9b36422aa90d0e7 /ci/prepare_env.py | |
parent | 9f923a7996f47b1187a759e28ad0728916d56fc9 (diff) |
Create config_functest patch to update the conf with scenario
Adding support of LXD scenario
JIRA: FUNCTEST-268
Change-Id: I5891ff9de674d99d32d8db747be501ee8a2e6609
Signed-off-by: boucherv <valentin.boucher@orange.com>
Diffstat (limited to 'ci/prepare_env.py')
-rwxr-xr-x | ci/prepare_env.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ci/prepare_env.py b/ci/prepare_env.py index e31afd495..116b1a6e2 100755 --- a/ci/prepare_env.py +++ b/ci/prepare_env.py @@ -46,10 +46,16 @@ CI_SCENARIO = "" CI_DEBUG = False REPOS_DIR = os.getenv('repos_dir') FUNCTEST_REPO = REPOS_DIR + '/functest/' +CONFIG_FUNCTEST_PATH = os.environ["CONFIG_FUNCTEST_YAML"] +CONFIG_PATCH_PATH = os.path.join(os.path.dirname( + CONFIG_FUNCTEST_PATH), "config_patch.yaml") -with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: +with open(CONFIG_FUNCTEST_PATH) as f: functest_yaml = yaml.safe_load(f) +with open(CONFIG_PATCH_PATH) as f: + functest_patch_yaml = yaml.safe_load(f) + FUNCTEST_CONF_DIR = functest_yaml.get("general").get( "directories").get("dir_functest_conf") @@ -183,6 +189,21 @@ def source_rc_file(): logger.debug("Used credentials: %s" % str) +def patch_config_file(): + updated = False + for key in functest_patch_yaml: + if key in CI_SCENARIO: + new_functest_yaml = dict(ft_utils.merge_dicts( + functest_yaml, functest_patch_yaml[key])) + updated = True + + if updated: + os.remove(CONFIG_FUNCTEST_PATH) + with open(CONFIG_FUNCTEST_PATH, "w") as f: + f.write(yaml.dump(new_functest_yaml, default_style='"')) + f.close() + + def verify_deployment(): print_separator() logger.info("Verifying OpenStack services...") @@ -262,6 +283,7 @@ def main(): check_env_variables() create_directories() source_rc_file() + patch_config_file() verify_deployment() install_rally() |