mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict) * Implement invocation in the base class's run() method have each action module call the run() method's implemention in the base class. * Return values from the action plugins' run() method takes the return value from the base class run() method into account so that invocation makes its way to the output. Fixes #12869
This commit is contained in:
parent
75cff7129c
commit
2e87c1f74e
27 changed files with 387 additions and 179 deletions
|
@ -29,9 +29,15 @@ from ansible.plugins.action import ActionBase
|
|||
|
||||
class TestActionBase(unittest.TestCase):
|
||||
|
||||
class DerivedActionBase(ActionBase):
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
# We're not testing the plugin run() method, just the helper
|
||||
# methods ActionBase defines
|
||||
return dict()
|
||||
|
||||
def test_sudo_only_if_user_differs(self):
|
||||
play_context = PlayContext()
|
||||
action_base = ActionBase(None, None, play_context, None, None, None)
|
||||
action_base = self.DerivedActionBase(None, None, play_context, None, None, None)
|
||||
action_base._connection = Mock(exec_command=Mock(return_value=(0, '', '')))
|
||||
|
||||
play_context.become = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue