From 9831e1597ff84108f6191ce41226fca4ab94083c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 5 Jun 2017 16:46:51 -0400 Subject: [PATCH] minor protection against bad config --- lib/ansible/inventory/manager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 4192d0aaa0a..5822e43e2db 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -182,8 +182,10 @@ class InventoryManager(object): for name in C.INVENTORY_ENABLED: plugin = inventory_loader.get(name) - name = os.path.splitext(os.path.basename(plugin._original_path))[0] - self._inventory_plugins.append(plugin) + if plugin: + self._inventory_plugins.append(plugin) + else: + display.warning('Failed to load inventory plugin, skipping %s' % name) if not self._inventory_plugins: raise AnsibleError("No inventory plugins available to generate inventory, make sure you have at least one whitelisted.")