mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
set cwd to task's basedir (#16805)
* switch cwd to basedir of task This restores previous behaviour in pre 2.0 and allows for 'local type' plugins and actions to have a more predictable relative path. fixes #14489 * removed FIXME since prev commit 'fixes' this * fix tests, now they need a loader (thanks jimi!)
This commit is contained in:
parent
363596c67f
commit
e2f17f8d9b
3 changed files with 11 additions and 3 deletions
|
@ -607,8 +607,10 @@ class TestActionBase(unittest.TestCase):
|
|||
self.assertRaises(AnsibleError, action_base._execute_module)
|
||||
|
||||
def test_action_base_sudo_only_if_user_differs(self):
|
||||
fake_loader = MagicMock()
|
||||
fake_loader.get_basedir.return_value = os.getcwd()
|
||||
play_context = PlayContext()
|
||||
action_base = DerivedActionBase(None, None, play_context, None, None, None)
|
||||
action_base = DerivedActionBase(None, None, play_context, fake_loader, None, None)
|
||||
action_base._connection = MagicMock(exec_command=MagicMock(return_value=(0, '', '')))
|
||||
action_base._connection._shell = MagicMock(append_command=MagicMock(return_value=('JOINED CMD')))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue