minor protection against bad config

This commit is contained in:
Brian Coca 2017-06-05 16:46:51 -04:00
parent 8432ba80c1
commit 9831e1597f

View file

@ -182,8 +182,10 @@ class InventoryManager(object):
for name in C.INVENTORY_ENABLED: for name in C.INVENTORY_ENABLED:
plugin = inventory_loader.get(name) plugin = inventory_loader.get(name)
name = os.path.splitext(os.path.basename(plugin._original_path))[0] if plugin:
self._inventory_plugins.append(plugin) self._inventory_plugins.append(plugin)
else:
display.warning('Failed to load inventory plugin, skipping %s' % name)
if not self._inventory_plugins: if not self._inventory_plugins:
raise AnsibleError("No inventory plugins available to generate inventory, make sure you have at least one whitelisted.") raise AnsibleError("No inventory plugins available to generate inventory, make sure you have at least one whitelisted.")