From a650421e397e404fa1593aa2216d8b504b9a6ce1 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 11 Aug 2014 10:16:31 -0500 Subject: [PATCH] Catch task parameter splitting errors nicely Fixes #8481 --- lib/ansible/playbook/task.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 686e956ad7..a728355621 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -239,7 +239,14 @@ class Task(object): self.notify = [ self.notify ] # split the action line into a module name + arguments - tokens = split_args(self.action) + try: + tokens = split_args(self.action) + except Exception, e: + if "unbalanced" in str(e): + raise errors.AnsibleError("There was an error while parsing the task %s.\n" % repr(self.action) + \ + "Make sure quotes are matched or escaped properly") + else: + raise if len(tokens) < 1: raise errors.AnsibleError("invalid/missing action in task. name: %s" % self.name) self.module_name = tokens[0]