Commit 98ed6921 by Michael DeHaan

Error -> ParserError

parent 79f41d9c
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import exceptions import exceptions
from ansible.errors import AnsibleError from ansible.errors import AnsibleParserError
from ansible.plugins import module_finder from ansible.plugins import module_finder
from ansible.parsing.splitter import parse_kv from ansible.parsing.splitter import parse_kv
...@@ -70,7 +70,7 @@ class ModuleArgsParser(object): ...@@ -70,7 +70,7 @@ class ModuleArgsParser(object):
the first part of the string is the name of the module the first part of the string is the name of the module
and the rest are strings pertaining to the arguments. and the rest are strings pertaining to the arguments.
''' '''
tokens = str.split() tokens = str.split()
if len(tokens) > 1: if len(tokens) > 1:
return (tokens[0], " ".join(tokens[1:])) return (tokens[0], " ".join(tokens[1:]))
...@@ -210,7 +210,7 @@ class ModuleArgsParser(object): ...@@ -210,7 +210,7 @@ class ModuleArgsParser(object):
# local_action is similar but also implies a delegate_to # local_action is similar but also implies a delegate_to
if action is not None: if action is not None:
raise AnsibleError("action and local_action are mutually exclusive") raise AnsibleParserError("action and local_action are mutually exclusive", obj=self._task)
thing = ds.get('local_action', '') thing = ds.get('local_action', '')
delegate_to = 'localhost' delegate_to = 'localhost'
action, args = self._normalize_parameters(thing) action, args = self._normalize_parameters(thing)
...@@ -219,14 +219,14 @@ class ModuleArgsParser(object): ...@@ -219,14 +219,14 @@ class ModuleArgsParser(object):
# module: <stuff> is the more new-style invocation # module: <stuff> is the more new-style invocation
if action is not None: if action is not None:
raise AnsibleError("conflicting action statements") raise AnsibleParserError("conflicting action statements", obj=self._task)
# walk the input dictionary to see we recognize a module name # walk the input dictionary to see we recognize a module name
for (item, value) in ds.iteritems(): for (item, value) in ds.iteritems():
if item in module_finder: if item in module_finder:
# finding more than one module name is a problem # finding more than one module name is a problem
if action is not None: if action is not None:
raise AnsibleError("conflicting action statements") raise AnsibleParserError("conflicting action statements", obj=self._task)
action = item action = item
thing = value thing = value
action, args = self._normalize_parameters(value, action=action) action, args = self._normalize_parameters(value, action=action)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment