summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Brown <ericwb@users.noreply.github.com>2018-04-05 13:31:21 -0700
committerSam Doran <sdoran@redhat.com>2018-04-05 16:31:21 -0400
commit4e38036bbd3e905c877abbf5b2361a0de1c146a8 (patch)
tree4870aa7af0b4b20206c32563a1398f8387e89540
parentb794fa4fe74c9063346dfed32727298aeecb2e8d (diff)
downloadansible-4e38036bbd3e905c877abbf5b2361a0de1c146a8.tar.gz
Replace the hard-coded temp path in gunicorn module (#38349)
The gunicorn module has a hard-coded reference to '/tmp' which may or may not be the actual temp directory for an operating system. This patch replaces '/tmp' with module.tmpdir which should resolve to the correct temp directory for the OS. Fixes Issue #36953 Signed-off-by: Eric Brown <browne@vmware.com>
-rw-r--r--lib/ansible/modules/web_infrastructure/gunicorn.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ansible/modules/web_infrastructure/gunicorn.py b/lib/ansible/modules/web_infrastructure/gunicorn.py
index 2a2acad619..b209c144a6 100644
--- a/lib/ansible/modules/web_infrastructure/gunicorn.py
+++ b/lib/ansible/modules/web_infrastructure/gunicorn.py
@@ -130,14 +130,6 @@ def main():
'user': '-u',
}
- # temporary files in case no option provided
- tmp_error_log = '/tmp/gunicorn.temp.error.log'
- tmp_pid_file = '/tmp/gunicorn.temp.pid'
-
- # remove temp file if exists
- remove_tmp_file(tmp_pid_file)
- remove_tmp_file(tmp_error_log)
-
module = AnsibleModule(
argument_spec=dict(
app=dict(required=True, type='str', aliases=['name']),
@@ -153,6 +145,14 @@ def main():
)
)
+ # temporary files in case no option provided
+ tmp_error_log = os.path.join(module.tmpdir, 'gunicorn.temp.error.log')
+ tmp_pid_file = os.path.join(module.tmpdir, 'gunicorn.temp.pid')
+
+ # remove temp file if exists
+ remove_tmp_file(tmp_pid_file)
+ remove_tmp_file(tmp_error_log)
+
# obtain app name and venv
params = module.params
app = params['app']