From b96877e5aa5530af2b629a956e47ce36bb267a87 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Tue, 13 Nov 2012 12:53:42 +0100 Subject: [PATCH] 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. --- lib/ansible/playbook/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 4e973710472..99870abf46e 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -87,7 +87,7 @@ class Task(object): raise errors.AnsibleError("the 'action' and 'local_action' attributes can not be used together") # Both are NOT defined 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', '')) # Only one of them is defined elif 'local_action' in ds: self.action = ds.get('local_action', '')