|
|
|
@ -80,6 +80,8 @@ _raw:
|
|
|
|
type: raw
|
|
|
|
type: raw
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from collections import ChainMap
|
|
|
|
|
|
|
|
|
|
|
|
import ansible.plugins.loader as plugin_loader
|
|
|
|
import ansible.plugins.loader as plugin_loader
|
|
|
|
|
|
|
|
|
|
|
|
from ansible import constants as C
|
|
|
|
from ansible import constants as C
|
|
|
|
@ -104,6 +106,9 @@ class LookupModule(LookupBase):
|
|
|
|
|
|
|
|
|
|
|
|
ret = []
|
|
|
|
ret = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# primarily use task vars, but fallback to existing constants when needed
|
|
|
|
|
|
|
|
var_context = ChainMap(variables, vars(C))
|
|
|
|
|
|
|
|
|
|
|
|
for term in terms:
|
|
|
|
for term in terms:
|
|
|
|
if not isinstance(term, str):
|
|
|
|
if not isinstance(term, str):
|
|
|
|
raise AnsibleError(f'Invalid setting identifier, {term!r} is not a {str}, its a {type(term)}.')
|
|
|
|
raise AnsibleError(f'Invalid setting identifier, {term!r} is not a {str}, its a {type(term)}.')
|
|
|
|
@ -119,7 +124,7 @@ class LookupModule(LookupBase):
|
|
|
|
if p is None:
|
|
|
|
if p is None:
|
|
|
|
raise AnsibleError(f"Unable to load {ptype} plugin {pname!r}.")
|
|
|
|
raise AnsibleError(f"Unable to load {ptype} plugin {pname!r}.")
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
result, origin = C.config.get_config_value_and_origin(term, plugin_type=ptype, plugin_name=pname, variables=variables)
|
|
|
|
result, origin = C.config.get_config_value_and_origin(term, plugin_type=ptype, plugin_name=pname, variables=var_context)
|
|
|
|
except AnsibleUndefinedConfigEntry as e:
|
|
|
|
except AnsibleUndefinedConfigEntry as e:
|
|
|
|
match missing:
|
|
|
|
match missing:
|
|
|
|
case 'error':
|
|
|
|
case 'error':
|
|
|
|
|