issue #461: Ansible 2.3-compatible _get_candidate_temp_dirs().

issue510
David Wilson 6 years ago
parent 9401c34f64
commit 3f31b166f6

@ -79,14 +79,17 @@ else:
def _get_candidate_temp_dirs(): def _get_candidate_temp_dirs():
options = ansible.constants.config.get_plugin_options('shell', 'sh') try:
# >=2.5
# Pre 2.5 this came from ansible.constants. options = ansible.constants.config.get_plugin_options('shell', 'sh')
remote_tmp = (options.get('remote_tmp') or remote_tmp = options.get('remote_tmp') or ansible.constants.DEFAULT_REMOTE_TMP
ansible.constants.DEFAULT_REMOTE_TMP) system_tmpdirs = options.get('system_tmpdirs', ('/var/tmp', '/tmp'))
dirs = list(options.get('system_tmpdirs', ('/var/tmp', '/tmp'))) except AttributeError:
dirs.insert(0, remote_tmp) # 2.3
return mitogen.utils.cast(dirs) remote_tmp = ansible.constants.DEFAULT_REMOTE_TMP
system_tmpdirs = ('/var/tmp', '/tmp')
return mitogen.utils.cast([remote_tmp] + list(system_tmpdirs))
def key_from_dict(**kwargs): def key_from_dict(**kwargs):

Loading…
Cancel
Save