diff --git a/lib/ansible/parsing/mod_args.py b/lib/ansible/parsing/mod_args.py index 50e39f48d0..8c268aa95e 100644 --- a/lib/ansible/parsing/mod_args.py +++ b/lib/ansible/parsing/mod_args.py @@ -254,7 +254,6 @@ class ModuleArgsParser: action, args = self._normalize_parameters(thing, additional_args=additional_args) # local_action - local_action = False if 'local_action' in self._task_ds: # local_action is similar but also implies a delegate_to if action is not None: @@ -263,6 +262,8 @@ class ModuleArgsParser: delegate_to = 'localhost' action, args = self._normalize_parameters(thing, additional_args=additional_args) + # module: is the more new-style invocation + # walk the input dictionary to see we recognize a module name for (item, value) in iteritems(self._task_ds): if item in module_loader or item == 'meta' or item == 'include': diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 51ba8e9869..ebf4bffe6f 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -95,10 +95,6 @@ class Task(Base, Conditional, Taggable, Become): self._role = role self._task_include = task_include - # special flag for local_action: tasks, to make sure their - # connection type of local isn't overridden incorrectly - self._local_action = False - super(Task, self).__init__() def get_path(self): @@ -140,16 +136,6 @@ class Task(Base, Conditional, Taggable, Become): t = Task(block=block, role=role, task_include=task_include) return t.load_data(data, variable_manager=variable_manager, loader=loader) - def load_data(self, ds, variable_manager=None, loader=None): - ''' - We override load_data for tasks so that we can pull special flags - out of the task args and set them internaly only so the user never - sees them. - ''' - t = super(Task, self).load_data(ds=ds, variable_manager=variable_manager, loader=loader) - t._local_action = t.args.pop('_local_action', False) - return t - def __repr__(self): ''' returns a human readable representation of the task ''' return "TASK: %s" % self.get_name() @@ -280,7 +266,6 @@ class Task(Base, Conditional, Taggable, Become): def copy(self, exclude_block=False): new_me = super(Task, self).copy() - new_me._local_action = self._local_action new_me._block = None if self._block and not exclude_block: @@ -298,7 +283,6 @@ class Task(Base, Conditional, Taggable, Become): def serialize(self): data = super(Task, self).serialize() - data['_local_action'] = self._local_action if self._block: data['block'] = self._block.serialize() @@ -317,7 +301,6 @@ class Task(Base, Conditional, Taggable, Become): #from ansible.playbook.task_include import TaskInclude block_data = data.get('block') - self._local_action = data.get('_local_action', False) if block_data: b = Block() diff --git a/test/units/parsing/test_mod_args.py b/test/units/parsing/test_mod_args.py index 1d5f817cb0..e83ddeea37 100644 --- a/test/units/parsing/test_mod_args.py +++ b/test/units/parsing/test_mod_args.py @@ -109,11 +109,11 @@ class TestModArgsDwim(unittest.TestCase): def test_local_action_string(self): m = ModuleArgsParser(dict(local_action='copy src=a dest=b')) - mod, args, connection = m.parse() - self._debug(mod, args, connection) + mod, args, delegate_to = m.parse() + self._debug(mod, args, delegate_to) self.assertEqual(mod, 'copy') - self.assertEqual(args, dict(src='a', dest='b', _local_action=True)) - self.assertIs(connection, 'local') + self.assertEqual(args, dict(src='a', dest='b')) + self.assertIs(delegate_to, 'localhost') def test_multiple_actions(self): m = ModuleArgsParser(dict(action='shell echo hi', local_action='shell echo hi'))