From 44e58863855b939de2e5911f94e291d36bad7516 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Fri, 29 Jun 2018 11:48:35 -0400 Subject: [PATCH] Fix setting required options for inventory plugins (#42049) * Fix setting required options for inventory plugins * call set_options for yaml and script plugin --- lib/ansible/inventory/manager.py | 1 - lib/ansible/plugins/inventory/script.py | 1 + lib/ansible/plugins/inventory/yaml.py | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 99f29cbacc..e93884eecd 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -183,7 +183,6 @@ class InventoryManager(object): for name in C.INVENTORY_ENABLED: plugin = inventory_loader.get(name) if plugin: - plugin.set_options() self._inventory_plugins.append(plugin) else: display.warning('Failed to load inventory plugin, skipping %s' % name) diff --git a/lib/ansible/plugins/inventory/script.py b/lib/ansible/plugins/inventory/script.py index 0876649331..8bc1de7311 100644 --- a/lib/ansible/plugins/inventory/script.py +++ b/lib/ansible/plugins/inventory/script.py @@ -85,6 +85,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): def parse(self, inventory, loader, path, cache=None): super(InventoryModule, self).parse(inventory, loader, path) + self.set_options() if cache is None: cache = self.get_option('cache') diff --git a/lib/ansible/plugins/inventory/yaml.py b/lib/ansible/plugins/inventory/yaml.py index 5983ce0674..436dbb6bdb 100644 --- a/lib/ansible/plugins/inventory/yaml.py +++ b/lib/ansible/plugins/inventory/yaml.py @@ -90,6 +90,7 @@ class InventoryModule(BaseFileInventoryPlugin): ''' parses the inventory file ''' super(InventoryModule, self).parse(inventory, loader, path) + self.set_options() try: data = self.loader.load_from_file(path, cache=False)