mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-16 17:01:30 +00:00
Make ready for data tagging (#9833)
* Fix dependent lookup. * Fix ansible_type plugin utils and adjust documentation of reveal_ansible_type filter and ansible_type test. * Fix diy callback plugin. * Adjust to Data Tagging. * Vendor and use internal code from ansible-core to fix YAML callback. Ref: https://github.com/ansible/ansible/issues/84781
This commit is contained in:
parent
1375cb65d6
commit
04cfce78ea
13 changed files with 346 additions and 139 deletions
|
|
@ -9,6 +9,12 @@ from ansible.errors import AnsibleError
|
|||
from ansible.playbook.conditional import Conditional
|
||||
from ansible.plugins.action import ActionBase
|
||||
|
||||
try:
|
||||
from ansible.utils.datatag import trust_value as _trust_value
|
||||
except ImportError:
|
||||
def _trust_value(input):
|
||||
return input
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
''' Fail with custom message '''
|
||||
|
|
@ -36,12 +42,16 @@ class ActionModule(ActionBase):
|
|||
|
||||
thats = self._task.args['that']
|
||||
|
||||
cond = Conditional(loader=self._loader)
|
||||
result['_ansible_verbose_always'] = True
|
||||
|
||||
for that in thats:
|
||||
cond.when = [str(self._make_safe(that))]
|
||||
test_result = cond.evaluate_conditional(templar=self._templar, all_vars=task_vars)
|
||||
if hasattr(self._templar, 'evaluate_conditional'):
|
||||
trusted_that = _trust_value(that) if _trust_value else that
|
||||
test_result = self._templar.evaluate_conditional(conditional=trusted_that)
|
||||
else:
|
||||
cond = Conditional(loader=self._loader)
|
||||
cond.when = [str(self._make_safe(that))]
|
||||
test_result = cond.evaluate_conditional(templar=self._templar, all_vars=task_vars)
|
||||
if not test_result:
|
||||
result['failed'] = True
|
||||
result['evaluated_to'] = test_result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue