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>
This commit is contained in:
Eric Brown 2018-04-05 13:31:21 -07:00 committed by Sam Doran
parent b794fa4fe7
commit 4e38036bbd

View file

@ -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']