From dfa1e8b0dc117627362fe9e89a0856c73a0419f0 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 7 Nov 2012 14:59:39 +0100 Subject: [PATCH] Bail out if an action is not a string Since YAML allows anything, we should enforce that actions are strings. This closes #1419. --- lib/ansible/playbook/task.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index ffa17c2972..0ccc4c57df 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -127,6 +127,10 @@ class Task(object): self.ignore_errors = ds.get('ignore_errors', False) + # action should be a string + if not isinstance(self.action, basestring): + raise errors.AnsibleError("action is of type '%s' and not a string in task. name: %s" % (type(self.action).__name__, self.name)) + # notify can be a string or a list, store as a list if isinstance(self.notify, basestring): self.notify = [ self.notify ]