Adds group_by_hostgroups parameter to Icinga2 inventory (#7998)

* (lots of commit messages)


---------

Co-authored-by: Gianluca Salvo <gianluca.salvo@gruppomol.it>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Gianluca Salvo 2024-03-24 18:01:34 +01:00 committed by GitHub
parent fb67df3051
commit 4947786d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 5 deletions

View file

@ -86,6 +86,8 @@ def get_option(option):
return {}
elif option == 'strict':
return False
elif option == 'group_by_hostgroups':
return True
else:
return None
@ -96,6 +98,7 @@ def test_populate(inventory, mocker):
inventory.icinga2_password = 'password'
inventory.icinga2_url = 'https://localhost:5665' + '/v1'
inventory.inventory_attr = "address"
inventory.group_by_hostgroups = True
# bypass authentication and API fetch calls
inventory._check_api = mocker.MagicMock(side_effect=check_api)