diff options
Diffstat (limited to 'dovetail/container.py')
-rw-r--r-- | dovetail/container.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/dovetail/container.py b/dovetail/container.py index e8840de3..e1191094 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -167,13 +167,15 @@ class Container(object): 'hosts.yaml') 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']: - for host in hosts_info['hosts_info']: - dt_utils.add_hosts_info(host) - hosts_config += " --add-host " - hosts_config += str(host) - cls.logger.debug('Get hosts info {}.'.format(host)) + hosts_yaml = yaml.safe_load(f) + if hosts_yaml['hosts_info']: + for ip, hostnames in hosts_yaml['hosts_info'].iteritems(): + dt_utils.add_hosts_info(ip, hostnames) + names_str = ' '.join(hostname for hostname in hostnames) + hosts_config += ' --add-host=\'{}\':{} '.format(names_str, + ip) + cls.logger.debug('Get hosts info {}:{}.'.format(ip, + names_str)) config = "" if type.lower() == "functest": |