summaryrefslogtreecommitdiffstats
path: root/dovetail/container.py
diff options
context:
space:
mode:
Diffstat (limited to 'dovetail/container.py')
-rw-r--r--dovetail/container.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index f3d08373..cf8e14e5 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -153,6 +153,23 @@ class Container(object):
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:
+ with open(hosts_config_file) as f:
+ hosts_info = yaml.safe_load(f)
+ if hosts_info['hosts_info']:
+ for host in hosts_info['hosts_info']:
+ dt_utils.add_hosts_info(host)
+ hosts_config += " --add-host "
+ hosts_config += str(host)
+ cls.logger.info('Get hosts info {}.'.format(hosts_config))
+ 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":
config = cls.set_functest_config(testcase_name)
@@ -168,22 +185,6 @@ class Container(object):
' -v %s:%s ' % (os.getenv("DOVETAIL_HOME"),
dovetail_config[type]['config']['dir'])
- hosts_config = ""
- hosts_config_path = os.path.abspath(
- os.path.join(os.path.dirname(__file__), 'userconfig'))
- try:
- with open(os.path.join(hosts_config_path, 'hosts.yaml')) as f:
- hosts_info = yaml.safe_load(f)
- if hosts_info['hosts_info']:
- for host in hosts_info['hosts_info']:
- hosts_config += " --add-host "
- hosts_config += str(host)
- cls.logger.info('Get hosts info {}.'.format(hosts_config))
- except Exception:
- cls.logger.warn('Failed to get hosts info in {}/hosts.yaml, '
- 'maybe some issues with domain name resolution.'
- .format(hosts_config_path))
-
cacert_volume = ""
https_enabled = dt_utils.check_https_enabled(cls.logger)
cacert = os.getenv('OS_CACERT',)