1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Pass tempdir via module args instead of the environment

This commit is contained in:
Toshio Kuratomi 2018-01-22 17:39:25 -08:00
parent 06dc840b51
commit ca8e4c806a
2 changed files with 4 additions and 3 deletions

View file

@ -47,6 +47,7 @@ PASS_VARS = {
'shell_executable': '_shell',
'socket': '_socket_path',
'syslog_facility': '_syslog_facility',
'tempdir': 'tempdir',
'verbosity': '_verbosity',
'version': 'ansible_version',
}
@ -845,9 +846,6 @@ class AnsibleModule(object):
self._legal_inputs = ['_ansible_%s' % k for k in PASS_VARS]
self._options_context = list()
# set tempdir to remote tmp
self.tempdir = os.environ.get('ANSIBLE_REMOTE_TEMP', None)
if add_file_common_args:
for k, v in FILE_COMMON_ARGUMENTS.items():
if k not in self.argument_spec:

View file

@ -631,6 +631,9 @@ class ActionBase(with_metaclass(ABCMeta, object)):
# make sure all commands use the designated shell executable
module_args['_ansible_shell_executable'] = self._play_context.executable
# make sure all commands use the designated temporary directory
module_args['_ansible_tempdir'] = self._connection._shell.tempdir
def _update_connection_options(self, options, variables=None):
''' ensures connections have the appropriate information '''
update = {}