diff options
Diffstat (limited to 'dovetail/container.py')
-rw-r--r-- | dovetail/container.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/dovetail/container.py b/dovetail/container.py index 14045165..e8840de3 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -68,16 +68,20 @@ class Container(object): # These are all just used by Functest's function push_results_to_db. # And has nothing to do with DoveTail running test cases. - ins_type = os.getenv('INSTALLER_TYPE', "unknown") - scenario = os.getenv('DEPLOY_SCENARIO', "unknown") + ins_type = "unknown" + scenario = "unknown" ins_type = ''.join([" -e INSTALLER_TYPE=", ins_type]) scenario = ''.join([" -e DEPLOY_SCENARIO=", scenario]) + ins_ip = os.getenv('INSTALLER_IP', "192.168.0.0") + ins_ip = " -e INSTALLER_IP={}".format(ins_ip) # vpn testcase only runs when scenario name includes bgpvpn # functest requirements if 'sdnvpn' in testcase_name: - ins_type = "-e INSTALLER_TYPE=netvirt" - scenario = " -e DEPLOY_SCENARIO=bgpvpn" - envs = "%s %s" % (ins_type, scenario) + ins_type = os.getenv('INSTALLER_TYPE', "netvirt") + ins_type = " -e INSTALLER_TYPE={}".format(ins_type) + scenario = os.getenv('DEPLOY_SCENARIO', "bgpvpn") + scenario = " -e DEPLOY_SCENARIO={}".format(scenario) + envs = "%s %s %s" % (ins_type, scenario, ins_ip) dovetail_config = dt_cfg.dovetail_config if dovetail_config['report_dest'].startswith("http"): @@ -149,14 +153,19 @@ class Container(object): # CI_DEBUG is used for showing the debug logs of the upstream projects # BUILD_TAG is the unique id for this test - envs = ' -e CI_DEBUG=true -e NODE_NAME=master' + envs = ' -e NODE_NAME=master' + DEBUG = os.getenv('DEBUG') + if DEBUG is not None and DEBUG.lower() == "true": + envs = envs + ' -e CI_DEBUG=true' + else: + envs = envs + ' -e CI_DEBUG=false' envs = envs + ' -e BUILD_TAG=%s-%s' % (dovetail_config['build_tag'], testcase_name) hosts_config = "" hosts_config_file = os.path.join(dovetail_config['config_dir'], 'hosts.yaml') - try: + if os.path.isfile(hosts_config_file): with open(hosts_config_file) as f: hosts_info = yaml.safe_load(f) if hosts_info['hosts_info']: @@ -165,10 +174,6 @@ class Container(object): hosts_config += " --add-host " hosts_config += str(host) cls.logger.debug('Get hosts info {}.'.format(host)) - except Exception: - cls.logger.warn('Failed to get hosts info in {}, ' - 'maybe some issues with domain name resolution.' - .format(hosts_config_file)) config = "" if type.lower() == "functest": |