mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
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:
parent
f2ade09dce
commit
e4c61ea9a1
5 changed files with 28 additions and 19 deletions
|
@ -129,21 +129,18 @@ class InventoryModule(BaseInventoryPlugin):
|
|||
except Exception as e:
|
||||
raise AnsibleParserError(e)
|
||||
|
||||
msg = ''
|
||||
if not self._config_data:
|
||||
# empty. this is not my config file
|
||||
return False
|
||||
if 'plugin' in self._config_data and self._config_data['plugin'] != self.NAME:
|
||||
# plugin config file, but not for us
|
||||
return False
|
||||
msg = 'File empty. this is not my config file'
|
||||
elif 'plugin' in self._config_data and self._config_data['plugin'] != self.NAME:
|
||||
msg = 'plugin config file, but not for us: %s' % self._config_data['plugin']
|
||||
elif 'plugin' not in self._config_data and 'clouds' not in self._config_data:
|
||||
# it's not a clouds.yaml file either
|
||||
return False
|
||||
msg = "it's not a plugin configuration nor a clouds.yaml file"
|
||||
elif not HAS_SHADE:
|
||||
msg = "shade is required for the OpenStack inventory plugin. OpenStack inventory sources will be skipped."
|
||||
|
||||
if not HAS_SHADE:
|
||||
self.display.warning(
|
||||
'shade is required for the OpenStack inventory plugin.'
|
||||
' OpenStack inventory sources will be skipped.')
|
||||
return False
|
||||
if msg:
|
||||
raise AnsibleParserError(msg)
|
||||
|
||||
# The user has pointed us at a clouds.yaml file. Use defaults for
|
||||
# everything.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue