config lookup can now handle collection plugins (#74250)
use load_name of valid plugin to find config, will handle the renamed loaded plugin that collections do: `ansible_collection.<ns>.<collname>.plugins.<type>.<name>`
This commit is contained in:
parent
f38d03f6fb
commit
3a244c5533
2 changed files with 8 additions and 2 deletions
2
changelogs/fragments/config_lookup_fix.yml
Normal file
2
changelogs/fragments/config_lookup_fix.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- config lookup, can also handle collection plugins now
|
|
@ -89,8 +89,12 @@ def _get_plugin_config(pname, ptype, config, variables):
|
||||||
try:
|
try:
|
||||||
# plugin creates settings on load, this is cached so not too expensive to redo
|
# plugin creates settings on load, this is cached so not too expensive to redo
|
||||||
loader = getattr(plugin_loader, '%s_loader' % ptype)
|
loader = getattr(plugin_loader, '%s_loader' % ptype)
|
||||||
dump = loader.get(pname, class_only=True)
|
p = loader.get(pname, class_only=True)
|
||||||
result = C.config.get_config_value(config, plugin_type=ptype, plugin_name=pname, variables=variables)
|
if p is None:
|
||||||
|
raise AnsibleLookupError('Unable to load %s plugin "%s"' % (ptype, pname))
|
||||||
|
result = C.config.get_config_value(config, plugin_type=ptype, plugin_name=p._load_name, variables=variables)
|
||||||
|
except AnsibleLookupError:
|
||||||
|
raise
|
||||||
except AnsibleError as e:
|
except AnsibleError as e:
|
||||||
msg = to_native(e)
|
msg = to_native(e)
|
||||||
if 'was not defined' in msg:
|
if 'was not defined' in msg:
|
||||||
|
|
Loading…
Reference in a new issue