mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Return multiple groups from inventory API.
This commit is contained in:
parent
30c019447b
commit
23a62f5a78
3 changed files with 18 additions and 3 deletions
|
@ -246,3 +246,13 @@ class TestInventory(unittest.TestCase):
|
|||
actual_hosts = inventory.get_hosts(host_names)
|
||||
actual_host_names = [host.name for host in actual_hosts]
|
||||
assert host_names == actual_host_names
|
||||
|
||||
def test_script_multiple_groups(self):
|
||||
inventory = self.script_inventory()
|
||||
vars = inventory.get_variables('zeus')
|
||||
|
||||
print "VARS=%s" % vars
|
||||
|
||||
assert vars == {'inventory_hostname': 'zeus',
|
||||
'inventory_hostname_short': 'zeus',
|
||||
'group_names': ['greek', 'major-god']}
|
||||
|
|
|
@ -15,13 +15,15 @@ options, args = parser.parse_args()
|
|||
systems = {
|
||||
"ungrouped": [ "jupiter", "saturn" ],
|
||||
"greek": [ "zeus", "hera", "poseidon" ],
|
||||
"norse": [ "thor", "odin", "loki" ]
|
||||
"norse": [ "thor", "odin", "loki" ],
|
||||
"major-god": [ "zeus", "odin" ],
|
||||
}
|
||||
|
||||
variables = {
|
||||
"thor": {
|
||||
"hammer": True
|
||||
}
|
||||
},
|
||||
"zeus": {},
|
||||
}
|
||||
|
||||
if options.list_hosts == True:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue