properlly report plugin name

pull/25170/head
Brian Coca 8 years ago
parent fd5db52fd9
commit bc403934ef

@ -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.

@ -380,6 +380,7 @@ class PluginLoader:
# set extra info on the module, in case we want it later # set extra info on the module, in case we want it later
setattr(obj, '_original_path', path) setattr(obj, '_original_path', path)
setattr(obj, '_load_name', name)
return obj return obj
def _display_plugin_load(self, class_name, name, searched_paths, path, found_in_cache=None, class_only=None): 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 # set extra info on the module, in case we want it later
setattr(obj, '_original_path', path) setattr(obj, '_original_path', path)
setattr(obj, '_load_name', name)
yield obj yield obj
action_loader = PluginLoader( action_loader = PluginLoader(

Loading…
Cancel
Save