mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Xen orchestra inventory: Added groups, keyed_groups and compose support (#3766)
* Xen orchestra inventory: Added groups, keyed_groups and compose support * Update plugins/inventory/xen_orchestra.py Remove extra params declaration Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
25e80762aa
commit
336f9465cb
2 changed files with 28 additions and 1 deletions
|
@ -129,6 +129,19 @@ objects = {
|
|||
}
|
||||
|
||||
|
||||
def get_option(option):
|
||||
if option == 'groups':
|
||||
return {}
|
||||
elif option == 'keyed_groups':
|
||||
return []
|
||||
elif option == 'compose':
|
||||
return {}
|
||||
elif option == 'strict':
|
||||
return False
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def serialize_groups(groups):
|
||||
return list(map(str, groups))
|
||||
|
||||
|
@ -144,7 +157,8 @@ def test_verify_file_bad_config(inventory):
|
|||
assert inventory.verify_file('foobar.xen_orchestra.yml') is False
|
||||
|
||||
|
||||
def test_populate(inventory):
|
||||
def test_populate(inventory, mocker):
|
||||
inventory.get_option = mocker.MagicMock(side_effect=get_option)
|
||||
inventory._populate(objects)
|
||||
actual = sorted(inventory.inventory.hosts.keys())
|
||||
expected = sorted(['c96ec4dd-28ac-4df4-b73c-4371bd202728', '222d8594-9426-468a-ad69-7a6f02330fa3',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue