mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
This commit is contained in:
parent
61573b1394
commit
f42961081d
@ -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()
|
||||
|
@ -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',
|
||||
])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user