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:
Samori Gorse 2021-11-22 13:53:25 +01:00 committed by GitHub
parent 25e80762aa
commit 336f9465cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -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',