mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-01 23:01:27 -07:00
register: fail when invalid var name is specified (#56456)
This commit is contained in:
parent
11c63d6c1e
commit
c6b40f4d40
4 changed files with 6 additions and 12 deletions
|
@ -30,7 +30,7 @@ from ansible.utils.listify import listify_lookup_plugin_terms
|
|||
from ansible.utils.unsafe_proxy import UnsafeProxy, wrap_var
|
||||
from ansible.vars.clean import namespace_facts, clean_facts
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.vars import combine_vars
|
||||
from ansible.utils.vars import combine_vars, isidentifier
|
||||
|
||||
display = Display()
|
||||
|
||||
|
@ -647,6 +647,9 @@ class TaskExecutor:
|
|||
# update the local copy of vars with the registered value, if specified,
|
||||
# or any facts which may have been generated by the module execution
|
||||
if self._task.register:
|
||||
if not isidentifier(self._task.register):
|
||||
raise AnsibleError("Invalid variable name in 'register' specified: '%s'" % self._task.register)
|
||||
|
||||
vars_copy[self._task.register] = wrap_var(result)
|
||||
|
||||
if self._task.async_val > 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue