1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix setting required options for inventory plugins (#42049)

* Fix setting required options for inventory plugins

* call set_options for yaml and script plugin
This commit is contained in:
Sloane Hertel 2018-06-29 11:48:35 -04:00 committed by Brian Coca
parent aea396f04b
commit 44e5886385
3 changed files with 2 additions and 1 deletions

View file

@ -183,7 +183,6 @@ 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)
if plugin: if plugin:
plugin.set_options()
self._inventory_plugins.append(plugin) self._inventory_plugins.append(plugin)
else: else:
display.warning('Failed to load inventory plugin, skipping %s' % name) display.warning('Failed to load inventory plugin, skipping %s' % name)

View file

@ -85,6 +85,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
def parse(self, inventory, loader, path, cache=None): def parse(self, inventory, loader, path, cache=None):
super(InventoryModule, self).parse(inventory, loader, path) super(InventoryModule, self).parse(inventory, loader, path)
self.set_options()
if cache is None: if cache is None:
cache = self.get_option('cache') cache = self.get_option('cache')

View file

@ -90,6 +90,7 @@ class InventoryModule(BaseFileInventoryPlugin):
''' parses the inventory file ''' ''' parses the inventory file '''
super(InventoryModule, self).parse(inventory, loader, path) super(InventoryModule, self).parse(inventory, loader, path)
self.set_options()
try: try:
data = self.loader.load_from_file(path, cache=False) data = self.loader.load_from_file(path, cache=False)