diff options
author | Zhijiang Hu <hu.zhijiang@zte.com.cn> | 2017-06-23 07:30:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-06-23 07:30:38 +0000 |
commit | 7795fc14f129a2c37607aa965d63e5831099681b (patch) | |
tree | 7d8eeeeba853b0f0ddfe00fee3f8da7aed418c24 /deploy/utils.py | |
parent | cd5dea763b8ba8c723fb2c21ea1e45928fd1a488 (diff) | |
parent | ccd2fe6cd04ed5e9a622a51d37bb1f0d97fc633b (diff) |
Merge "add the scenarios option"
Diffstat (limited to 'deploy/utils.py')
-rw-r--r-- | deploy/utils.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/deploy/utils.py b/deploy/utils.py index 0c5b1370..102ae1f3 100644 --- a/deploy/utils.py +++ b/deploy/utils.py @@ -19,6 +19,9 @@ path_join = os.path.join CWD = os.getcwd() WORKSPACE = os.path.normpath(path_join(os.path.dirname(__file__), '..')) BASE = CWD +valid_scenario_list = ['os-nosdn-nofeature-noha', + 'os-odl_l3-nofeature-noha', + 'os-odl_l2-nofeature-noha'] def get_logger(): @@ -136,3 +139,23 @@ def run_shell(cmd, check=False): LI('Successful command: ' + str(cmd)) return return_code + + +def merge_dicts(dict1, dict2): + for k in set(dict1).union(dict2): + if k in dict1 and k in dict2: + if isinstance(dict1[k], dict) and isinstance(dict2[k], dict): + yield (k, dict(merge_dicts(dict1[k], dict2[k]))) + continue + # If one of the values is not a dict nor a list, + # you can't continue merging it. + # Value from second dict overrides one in first if exists. + if k in dict2: + yield (k, dict2[k]) + else: + yield (k, dict1[k]) + + +def check_scenario_valid(scenario): + if not (scenario in valid_scenario_list): + err_exit('Invald scenario:%s' % scenario) |