Merge pull request #4297 from rooftopcellist/rsyslog_term

Rsyslog config race condition between saving and writing the file
This commit is contained in:
Christian Adams 2020-05-06 13:41:13 -04:00 committed by GitHub
commit d0a7f7f4e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import socket
from socket import SHUT_RDWR
# Django
from django.db import connection
from django.conf import settings
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
@ -130,7 +131,8 @@ class SettingSingletonDetail(RetrieveUpdateDestroyAPIView):
setting.save(update_fields=['value'])
settings_change_list.append(key)
if settings_change_list:
handle_setting_changes.delay(settings_change_list)
connection.on_commit(lambda: handle_setting_changes.delay(settings_change_list))
def destroy(self, request, *args, **kwargs):
instance = self.get_object()
@ -145,7 +147,7 @@ class SettingSingletonDetail(RetrieveUpdateDestroyAPIView):
setting.delete()
settings_change_list.append(setting.key)
if settings_change_list:
handle_setting_changes.delay(settings_change_list)
connection.on_commit(lambda: handle_setting_changes.delay(settings_change_list))
# When TOWER_URL_BASE is deleted from the API, reset it to the hostname
# used to make the request as a default.

View File

@ -288,7 +288,7 @@ def handle_setting_changes(setting_keys):
setting.startswith('LOG_AGGREGATOR')
for setting in setting_keys
]):
connection.on_commit(reconfigure_rsyslog)
reconfigure_rsyslog()
@task(queue='tower_broadcast_all')

View File

@ -51,7 +51,7 @@ command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslo
autostart = true
autorestart = true
stopwaitsecs = 5
stopsignal=KILL
stopsignal=TERM
stopasgroup=true
killasgroup=true
redirect_stderr=true

View File

@ -58,7 +58,7 @@ data:
autostart = true
autorestart = true
stopwaitsecs = 5
stopsignal=KILL
stopsignal=TERM
stopasgroup=true
killasgroup=true
redirect_stderr=true

View File

@ -76,7 +76,7 @@ command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslo
autostart = true
autorestart = true
stopwaitsecs = 5
stopsignal=KILL
stopsignal=TERM
stopasgroup=true
killasgroup=true
redirect_stderr=true