mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
Pass tempdir via module args instead of the environment
This commit is contained in:
parent
06dc840b51
commit
ca8e4c806a
2 changed files with 4 additions and 3 deletions
|
@ -47,6 +47,7 @@ PASS_VARS = {
|
||||||
'shell_executable': '_shell',
|
'shell_executable': '_shell',
|
||||||
'socket': '_socket_path',
|
'socket': '_socket_path',
|
||||||
'syslog_facility': '_syslog_facility',
|
'syslog_facility': '_syslog_facility',
|
||||||
|
'tempdir': 'tempdir',
|
||||||
'verbosity': '_verbosity',
|
'verbosity': '_verbosity',
|
||||||
'version': 'ansible_version',
|
'version': 'ansible_version',
|
||||||
}
|
}
|
||||||
|
@ -845,9 +846,6 @@ class AnsibleModule(object):
|
||||||
self._legal_inputs = ['_ansible_%s' % k for k in PASS_VARS]
|
self._legal_inputs = ['_ansible_%s' % k for k in PASS_VARS]
|
||||||
self._options_context = list()
|
self._options_context = list()
|
||||||
|
|
||||||
# set tempdir to remote tmp
|
|
||||||
self.tempdir = os.environ.get('ANSIBLE_REMOTE_TEMP', None)
|
|
||||||
|
|
||||||
if add_file_common_args:
|
if add_file_common_args:
|
||||||
for k, v in FILE_COMMON_ARGUMENTS.items():
|
for k, v in FILE_COMMON_ARGUMENTS.items():
|
||||||
if k not in self.argument_spec:
|
if k not in self.argument_spec:
|
||||||
|
|
|
@ -631,6 +631,9 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||||
# make sure all commands use the designated shell executable
|
# make sure all commands use the designated shell executable
|
||||||
module_args['_ansible_shell_executable'] = self._play_context.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):
|
def _update_connection_options(self, options, variables=None):
|
||||||
''' ensures connections have the appropriate information '''
|
''' ensures connections have the appropriate information '''
|
||||||
update = {}
|
update = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue