summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/urls.py
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-02-15 09:01:02 -0800
committerGitHub <noreply@github.com>2018-02-15 09:01:02 -0800
commit06f73ad578d840c7ea5875b7cd4ffd08e2d9d0e8 (patch)
tree721a0ad5a9a1fa03229ad19a8dcd10dbb54a10b6 /lib/ansible/module_utils/urls.py
parent2678508d427618c6d50f447f41689a1b31d72b86 (diff)
downloadansible-06f73ad578d840c7ea5875b7cd4ffd08e2d9d0e8.tar.gz
Normalize usage of temp and tmp on tmp (#36221)
* Normalize usage of temp and tmp on tmp * Rename system_tmps system_tmpdirs * Add ANSIBLE_REMOTE_TMP spelling of environment variables
Diffstat (limited to 'lib/ansible/module_utils/urls.py')
-rw-r--r--lib/ansible/module_utils/urls.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py
index e0347035c8..d4de90edb1 100644
--- a/lib/ansible/module_utils/urls.py
+++ b/lib/ansible/module_utils/urls.py
@@ -988,7 +988,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
module.fail_json(msg='urlparse is not installed')
# ensure we use proper tempdir
- tempfile.tempdir = module.tempdir
+ old_tempdir = tempfile.tempdir
+ tempfile.tempdir = module.tmpdir
# Get validate_certs from the module params
validate_certs = module.params.get('validate_certs', True)
@@ -1052,5 +1053,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
except Exception as e:
info.update(dict(msg="An unknown error occurred: %s" % to_native(e), status=-1),
exception=traceback.format_exc())
+ finally:
+ tempfile.tempdir = old_tempdir
return r, info