create module tmpdir based on remote_tmp (#39833)

* create module tmpdir based on remote_tmp

* Source remote_tmp from controller if possible

* Fixed sanity test and not use lambda

* Added expansion of env vars to the remote tmp

* Fixed sanity issues

* Added note around shell remote_tmp option

* Changed fallback tmp dir to ~/.ansible/tmp to make shell defaults
This commit is contained in:
Jordan Borean 2018-05-15 09:31:21 +10:00 committed by GitHub
parent 1d640182c6
commit 44ab948e5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 5 deletions

View file

@ -414,12 +414,16 @@ class TestActionBase(unittest.TestCase):
to_run.append(arg_path)
return " ".join(to_run)
def get_option(option):
return {}.get(option)
mock_connection = MagicMock()
mock_connection.build_module_command.side_effect = build_module_command
mock_connection.socket_path = None
mock_connection._shell.get_remote_filename.return_value = 'copy.py'
mock_connection._shell.join_path.side_effect = os.path.join
mock_connection._shell.tmpdir = '/var/tmp/mytempdir'
mock_connection._shell.get_option = get_option
# we're using a real play context here
play_context = PlayContext()