This commit is contained in:
ranl 2013-08-29 11:50:20 +03:00
parent 61573b1394
commit f42961081d
2 changed files with 6 additions and 10 deletions

View File

@ -215,9 +215,10 @@ def add_host(ip, alias):
def _write_hosts(hosts):
lines = []
for ip, aliases in hosts.iteritems():
line = '{0}\t'.format(ip)
for alias in aliases:
line = '{0}\t{1}'.format(line, alias)
line = '{0}\t\t{1}'.format(
ip,
'\t\t'.join(aliases)
)
lines.append(line)
hfn = __get_hosts_filename()

View File

@ -208,13 +208,8 @@ class HostsModuleTest(integration.ModuleCase):
lines = salt.utils.fopen(HFN, 'r').read().splitlines()
self.assertEqual(lines, [
'192.168.1.3\t\thost3.fqdn.com',
'192.168.1.1\t\thost1.fqdn.com',
'192.168.1.1\t\thost1',
'192.168.1.1\t\thost1-reorder',
'192.168.1.2\t\thost2.fqdn.com',
'192.168.1.2\t\thost2',
'192.168.1.2\t\toldhost2',
'192.168.1.2\t\thost2-reorder'
'192.168.1.1\t\thost1.fqdn.com\t\thost1\t\thost1-reorder',
'192.168.1.2\t\thost2.fqdn.com\t\thost2\t\toldhost2\t\thost2-reorder',
])