Skip to content

Commit

Permalink
Catch task parameter splitting errors nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed Aug 11, 2014
1 parent 9f34ea5 commit a650421
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ansible/playbook/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ def __init__(self, play, ds, module_vars=None, default_vars=None, additional_con
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]
Expand Down

0 comments on commit a650421

Please sign in to comment.