mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Print the task name (if any) when complaining
After spending 10 minutes to find which playbook had an action/local_action missing, I changed the error to include the task name (if set). The error eventually was caused because I added a name to a task, but the dash before the existing action was not removed.
This commit is contained in:
parent
f54af8f0f6
commit
b96877e5aa
1 changed files with 1 additions and 1 deletions
|
@ -87,7 +87,7 @@ class Task(object):
|
||||||
raise errors.AnsibleError("the 'action' and 'local_action' attributes can not be used together")
|
raise errors.AnsibleError("the 'action' and 'local_action' attributes can not be used together")
|
||||||
# Both are NOT defined
|
# Both are NOT defined
|
||||||
elif (not 'action' in ds) and (not 'local_action' in ds):
|
elif (not 'action' in ds) and (not 'local_action' in ds):
|
||||||
raise errors.AnsibleError("task missing an 'action' attribute")
|
raise errors.AnsibleError("'action' or 'local_action' attribute missing in task \"%s\"" % ds.get('name', '<Unnamed>'))
|
||||||
# Only one of them is defined
|
# Only one of them is defined
|
||||||
elif 'local_action' in ds:
|
elif 'local_action' in ds:
|
||||||
self.action = ds.get('local_action', '')
|
self.action = ds.get('local_action', '')
|
||||||
|
|
Loading…
Reference in a new issue