mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Fix hostname expansion bug in inventory parser
This commit is contained in:
@@ -150,6 +150,17 @@ class TestInventory(unittest.TestCase):
|
||||
print expected
|
||||
assert vars == expected
|
||||
|
||||
def test_complex_group_names(self):
|
||||
inventory = self.complex_inventory()
|
||||
tests = {
|
||||
'host1': [ 'role1' ],
|
||||
'host2': [ 'role1', 'role2' ],
|
||||
'host3': [ 'role2' ]
|
||||
}
|
||||
for host, roles in tests.iteritems():
|
||||
group_names = inventory.get_variables(host)['group_names']
|
||||
assert sorted(group_names) == sorted(roles)
|
||||
|
||||
def test_complex_exclude(self):
|
||||
inventory = self.complex_inventory()
|
||||
hosts = inventory.list_hosts("nc:florida:!triangle:!orlando")
|
||||
|
||||
@@ -73,4 +73,9 @@ d=100002
|
||||
[us:vars]
|
||||
c=1000000
|
||||
|
||||
[role1]
|
||||
host[1:2]
|
||||
|
||||
[role2]
|
||||
host[2:3]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user