mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
Yaml inventory more tolerant (#48883)
* make yaml inv more tolerant to comments * add tests for bad inventory processing fixes #47254
This commit is contained in:
parent
bd1050dfc7
commit
fc71cde7d3
7 changed files with 112 additions and 1 deletions
|
@ -135,7 +135,13 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
|
||||
for key in group_data:
|
||||
|
||||
if key == 'vars':
|
||||
if not isinstance(group_data[key], (MutableMapping, NoneType)):
|
||||
self.display.warning('Skipping key (%s) in group (%s) as it is not a mapping, it is a %s' % (key, group, type(group_data[key])))
|
||||
continue
|
||||
|
||||
if isinstance(group_data[key], NoneType):
|
||||
self.display.vvv('Skipping empty key (%s) in group (%s)' % (key, group))
|
||||
elif key == 'vars':
|
||||
for var in group_data[key]:
|
||||
self.inventory.set_variable(group, var, group_data[key][var])
|
||||
elif key == 'children':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue