Fix setting required options for inventory plugins - backport/2.6/42049 (#42120)
* Fix setting required options for inventory plugins (#42049)
* Fix setting required options for inventory plugins
* call set_options for yaml and script plugin
(cherry picked from commit 44e5886385
)
* changelog
This commit is contained in:
parent
3cbf319ee7
commit
851725d72a
4 changed files with 7 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
bugfixes:
|
||||
- inventory manager - This fixes required options being populated before the
|
||||
inventory config file is read, so the required options may be set in the
|
||||
config file.
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue