|
|
@ -246,19 +246,20 @@ class InventoryManager(object):
|
|
|
|
# try source with each plugin
|
|
|
|
# try source with each plugin
|
|
|
|
failures = []
|
|
|
|
failures = []
|
|
|
|
for plugin in self._inventory_plugins:
|
|
|
|
for plugin in self._inventory_plugins:
|
|
|
|
display.debug(u'Attempting to use plugin %s' % plugin)
|
|
|
|
plugin_name = to_text(getattr(plugin, '_load_name', getattr(plugin, '_original_path', '')))
|
|
|
|
|
|
|
|
display.debug(u'Attempting to use plugin %s' % plugin_name)
|
|
|
|
|
|
|
|
|
|
|
|
# initialize
|
|
|
|
# initialize
|
|
|
|
if plugin.verify_file(source):
|
|
|
|
if plugin.verify_file(source):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
plugin.parse(self._inventory, self._loader, source, cache=cache)
|
|
|
|
plugin.parse(self._inventory, self._loader, source, cache=cache)
|
|
|
|
parsed = True
|
|
|
|
parsed = True
|
|
|
|
display.vvv(u'Parsed %s inventory source with %s plugin' % (to_text(source), plugin))
|
|
|
|
display.vvv(u'Parsed %s inventory source with %s plugin' % (to_text(source), plugin_name))
|
|
|
|
break
|
|
|
|
break
|
|
|
|
except AnsibleParserError as e:
|
|
|
|
except AnsibleParserError as e:
|
|
|
|
failures.append(u'\n* Failed to parse %s with %s inventory plugin: %s\n' %(to_text(source), plugin, to_text(e)))
|
|
|
|
failures.append(u'\n* Failed to parse %s with %s inventory plugin: %s\n' %(to_text(source), plugin_name, to_text(e)))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
display.debug(u'%s did not meet %s requirements' % (to_text(source), plugin))
|
|
|
|
display.debug(u'%s did not meet %s requirements' % (to_text(source), plugin_name))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if failures:
|
|
|
|
if failures:
|
|
|
|
# only if no plugin processed files should we show errors.
|
|
|
|
# only if no plugin processed files should we show errors.
|
|
|
|