don't ignore templated _raw_params that k=v parser failed to parse (#79913)

fixes #79862
pull/79958/head
Matt Davis 2 years ago committed by GitHub
parent 2525d0a136
commit e1d298ed61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- TaskExecutor - don't ignore templated _raw_params that k=v parser failed to parse (https://github.com/ansible/ansible/issues/79862)

@ -515,6 +515,10 @@ class TaskExecutor:
"(see https://docs.ansible.com/ansible/devel/reference_appendices/faq.html#argsplat-unsafe)") "(see https://docs.ansible.com/ansible/devel/reference_appendices/faq.html#argsplat-unsafe)")
variable_params.update(self._task.args) variable_params.update(self._task.args)
self._task.args = variable_params self._task.args = variable_params
else:
# if we didn't get a dict, it means there's garbage remaining after k=v parsing, just give up
# see https://github.com/ansible/ansible/issues/79862
raise AnsibleError(f"invalid or malformed argument: '{variable_params}'")
# update no_log to task value, now that we have it templated # update no_log to task value, now that we have it templated
no_log = self._task.no_log no_log = self._task.no_log

@ -9,4 +9,16 @@
# ensure we properly test for an action name, not a task name when cheking for a meta task # ensure we properly test for an action name, not a task name when cheking for a meta task
- name: "meta" - name: "meta"
debug: debug:
msg: Hello msg: Hello
- name: ensure malformed raw_params on arbitrary actions are not ignored
debug:
garbage {{"with a template"}}
ignore_errors: true
register: bad_templated_raw_param
- assert:
that:
- bad_templated_raw_param is failed
- |
"invalid or malformed argument: 'garbage with a template'" in bad_templated_raw_param.msg

Loading…
Cancel
Save