summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2022-09-28 09:15:43 -0400
committerGitHub <noreply@github.com>2022-09-28 08:15:43 -0500
commite5fd4ae7478d2c7ae085e3c99e6717525569a547 (patch)
tree27b2b208ee63ba5425a5e09af755ef4f0307ce6b
parent30b7bfc1d892bb9985b25fe02de23551928ec7f7 (diff)
downloadansible-e5fd4ae7478d2c7ae085e3c99e6717525569a547.tar.gz
plugin loader fix existing config testing (#78859) (#78891)
create specific function to find config entry to avoid repopulating constantly (cherry picked from commit 4115ddd135a0445092c9f9a7b5904942ceedd57c)
-rw-r--r--changelogs/fragments/plugin_loader_fix.yml2
-rw-r--r--lib/ansible/config/manager.py8
-rw-r--r--lib/ansible/plugins/loader.py2
3 files changed, 11 insertions, 1 deletions
diff --git a/changelogs/fragments/plugin_loader_fix.yml b/changelogs/fragments/plugin_loader_fix.yml
new file mode 100644
index 0000000000..85d5f0735a
--- /dev/null
+++ b/changelogs/fragments/plugin_loader_fix.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - plugin loader, fix detection for existing configuration before initializing for a plugin
diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py
index 4efaf1aa27..e1fde1d30a 100644
--- a/lib/ansible/config/manager.py
+++ b/lib/ansible/config/manager.py
@@ -383,6 +383,14 @@ class ConfigManager(object):
return ret
+ def has_configuration_definition(self, plugin_type, name):
+
+ has = False
+ if plugin_type in self._plugins:
+ has = (name in self._plugins[plugin_type])
+
+ return has
+
def get_configuration_definitions(self, plugin_type=None, name=None, ignore_private=False):
''' just list the possible settings, either base or for specific plugins or plugin '''
diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py
index 78487d1cb1..dbaa667730 100644
--- a/lib/ansible/plugins/loader.py
+++ b/lib/ansible/plugins/loader.py
@@ -399,7 +399,7 @@ class PluginLoader:
type_name = get_plugin_class(self.class_name)
# if type name != 'module_doc_fragment':
- if type_name in C.CONFIGURABLE_PLUGINS and not C.config.get_configuration_definition(type_name, name):
+ if type_name in C.CONFIGURABLE_PLUGINS and not C.config.has_configuration_definition(type_name, name):
dstring = AnsibleLoader(getattr(module, 'DOCUMENTATION', ''), file_name=path).get_single_data()
# TODO: allow configurable plugins to use sidecar