changed local_action to alias to connection=local vs delegate_to=localhost

fixes #11998, but still leaves issue of delegate_to: localhost not working
This commit is contained in:
Brian Coca 2015-08-18 18:31:29 -04:00
parent 5eeeb87d82
commit 7a4a156d91
2 changed files with 8 additions and 9 deletions

View file

@ -234,10 +234,9 @@ class ModuleArgsParser:
task, dealing with all sorts of levels of fuzziness. task, dealing with all sorts of levels of fuzziness.
''' '''
thing = None thing = None
action = None action = None
delegate_to = self._task_ds.get('delegate_to', None) connection = self._task_ds.get('connection', None)
args = dict() args = dict()
@ -256,11 +255,11 @@ class ModuleArgsParser:
# local_action # local_action
if 'local_action' in self._task_ds: if 'local_action' in self._task_ds:
# local_action is similar but also implies a delegate_to # local_action is similar but also implies a connection='local'
if action is not None: if action is not None:
raise AnsibleParserError("action and local_action are mutually exclusive", obj=self._task_ds) raise AnsibleParserError("action and local_action are mutually exclusive", obj=self._task_ds)
thing = self._task_ds.get('local_action', '') thing = self._task_ds.get('local_action', '')
delegate_to = 'localhost' connection = 'local'
action, args = self._normalize_parameters(thing, additional_args=additional_args) action, args = self._normalize_parameters(thing, additional_args=additional_args)
# module: <stuff> is the more new-style invocation # module: <stuff> is the more new-style invocation
@ -289,4 +288,4 @@ class ModuleArgsParser:
# shell modules require special handling # shell modules require special handling
(action, args) = self._handle_shell_weirdness(action, args) (action, args) = self._handle_shell_weirdness(action, args)
return (action, args, delegate_to) return (action, args, connection)

View file

@ -157,11 +157,11 @@ class Task(Base, Conditional, Taggable, Become):
# and the delegate_to value from the various possible forms # and the delegate_to value from the various possible forms
# supported as legacy # supported as legacy
args_parser = ModuleArgsParser(task_ds=ds) args_parser = ModuleArgsParser(task_ds=ds)
(action, args, delegate_to) = args_parser.parse() (action, args, connection) = args_parser.parse()
new_ds['action'] = action new_ds['action'] = action
new_ds['args'] = args new_ds['args'] = args
new_ds['delegate_to'] = delegate_to new_ds['connection'] = connection
# we handle any 'vars' specified in the ds here, as we may # we handle any 'vars' specified in the ds here, as we may
# be adding things to them below (special handling for includes). # be adding things to them below (special handling for includes).
@ -174,7 +174,7 @@ class Task(Base, Conditional, Taggable, Become):
new_ds['vars'] = dict() new_ds['vars'] = dict()
for (k,v) in ds.iteritems(): for (k,v) in ds.iteritems():
if k in ('action', 'local_action', 'args', 'delegate_to') or k == action or k == 'shell': if k in ('action', 'local_action', 'args', 'connection') or k == action or k == 'shell':
# we don't want to re-assign these values, which were # we don't want to re-assign these values, which were
# determined by the ModuleArgsParser() above # determined by the ModuleArgsParser() above
continue continue