diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 6876bf38349..0dcc6b13c45 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -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. diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index 104c2dbf820..57fdf1e7e4e 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -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(