mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
properlly report plugin name
This commit is contained in:
parent
fd5db52fd9
commit
bc403934ef
2 changed files with 7 additions and 4 deletions
|
@ -246,19 +246,20 @@ class InventoryManager(object):
|
|||
# try source with each plugin
|
||||
failures = []
|
||||
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
|
||||
if plugin.verify_file(source):
|
||||
try:
|
||||
plugin.parse(self._inventory, self._loader, source, cache=cache)
|
||||
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
|
||||
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:
|
||||
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:
|
||||
if failures:
|
||||
# only if no plugin processed files should we show errors.
|
||||
|
|
|
@ -380,6 +380,7 @@ class PluginLoader:
|
|||
|
||||
# set extra info on the module, in case we want it later
|
||||
setattr(obj, '_original_path', path)
|
||||
setattr(obj, '_load_name', name)
|
||||
return obj
|
||||
|
||||
def _display_plugin_load(self, class_name, name, searched_paths, path, found_in_cache=None, class_only=None):
|
||||
|
@ -444,6 +445,7 @@ class PluginLoader:
|
|||
|
||||
# set extra info on the module, in case we want it later
|
||||
setattr(obj, '_original_path', path)
|
||||
setattr(obj, '_load_name', name)
|
||||
yield obj
|
||||
|
||||
action_loader = PluginLoader(
|
||||
|
|
Loading…
Reference in a new issue