mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Clean up rsyslog config temp dir
- dir is cleaned up at end of 'with' context
This commit is contained in:
@@ -114,9 +114,9 @@ def construct_rsyslog_conf_template(settings=settings):
|
|||||||
def reconfigure_rsyslog():
|
def reconfigure_rsyslog():
|
||||||
tmpl = construct_rsyslog_conf_template()
|
tmpl = construct_rsyslog_conf_template()
|
||||||
# Write config to a temp file then move it to preserve atomicity
|
# Write config to a temp file then move it to preserve atomicity
|
||||||
temp_dir = tempfile.TemporaryDirectory(prefix='rsyslog-conf-', dir='/tmp')
|
with tempfile.TemporaryDirectory(prefix='rsyslog-conf-') as temp_dir:
|
||||||
path = temp_dir.name + '/rsyslog.conf.temp'
|
path = temp_dir + '/rsyslog.conf.temp'
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
f.write(tmpl + '\n')
|
f.write(tmpl + '\n')
|
||||||
shutil.move(path, '/var/lib/awx/rsyslog/rsyslog.conf')
|
shutil.move(path, '/var/lib/awx/rsyslog/rsyslog.conf')
|
||||||
supervisor_service_command(command='restart', service='awx-rsyslogd')
|
supervisor_service_command(command='restart', service='awx-rsyslogd')
|
||||||
|
|||||||
Reference in New Issue
Block a user