fix 'return false' from parse

this was abandoned early on the manger side  but seems like we left behind on plugin side.
more flexible extensions with yaml plugin
validate data correctly for yaml/constructed
fixed issue with only adding one child to keyed, the group only got the host that forced it's creation

fixes #31382
fixes #31365
This commit is contained in:
Brian Coca 2017-10-06 00:10:41 -04:00 committed by Brian Coca
parent f2ade09dce
commit e4c61ea9a1
5 changed files with 28 additions and 19 deletions

View file

@ -88,7 +88,11 @@ class InventoryModule(BaseFileInventoryPlugin):
raise AnsibleParserError(e)
if not data:
return False
raise AnsibleParserError('Parsed empty YAML file')
elif not isinstance(data, MutableMapping):
raise AnsibleParserError('YAML inventory has invalid structure, it should be a dictionary, got: %s' % type(data))
elif data.get('plugin'):
raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
# We expect top level keys to correspond to groups, iterate over them
# to get host, vars and subgroups (which we iterate over recursivelly)