icinga2_objects is sometimes wrongly treated as a list
Donien opened this issue · 0 comments
TLDR
We'd need to properly check that icinga2_objects
from within a play's vars
key is a list before trying to treat it as such.
Currently icinga2_objects
- comming from a play's vars
key - is collected and treated as a list
if
- icinga2_objects is defined
- vars['icinga2_objects'][icinga2_config_host] is not defined
This means that vars['icinga2_objects']
could be a dict and the code would try to treat it as a list as long as the current host (hostA) is not mentioned as a key to the dict.
vars:
icinga2_objects:
hostB:
- ...
The above example would skipp the task at hand if currently handling hostB. But if handling hostA the task would fail due to hostA not being a key of icinga2_objects
and thus the task treating icinga2_objects
as a list.
ansible-collection-icinga/roles/icinga2/tasks/objects.yml
Lines 1 to 11 in 5925279