blob: 8850ab79a9b4309a8ac6f9afce79a720d6efb13d [file] [log] [blame]
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03001import json
2
3
4def test_etc_hosts(local_salt_client):
5 nodes_info = local_salt_client.cmd(
6 tgt='*',
7 param='cat /etc/hosts',
8 expr_form='compound')
9 result = {}
10 for node in nodes_info.keys():
11 if isinstance(nodes_info[node], bool):
12 result[node] = 'Cannot access this node'
13 continue
14 for nd in nodes_info.keys():
15 if nd not in nodes_info[node]:
16 if node in result:
17 result[node] += ',' + nd
18 else:
19 result[node] = nd
20 assert len(result) <= 1, \
21 "Some hosts are not presented in /etc/hosts: {0}".format(
22 json.dumps(result, indent=4))