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
5 changed files with 8 additions and 6 deletions

View File

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

View File

@@ -288,7 +288,7 @@ def handle_setting_changes(setting_keys):
setting.startswith('LOG_AGGREGATOR') setting.startswith('LOG_AGGREGATOR')
for setting in setting_keys for setting in setting_keys
]): ]):
connection.on_commit(reconfigure_rsyslog) reconfigure_rsyslog()
@task(queue='tower_broadcast_all') @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 autostart = true
autorestart = true autorestart = true
stopwaitsecs = 5 stopwaitsecs = 5
stopsignal=KILL stopsignal=TERM
stopasgroup=true stopasgroup=true
killasgroup=true killasgroup=true
redirect_stderr=true redirect_stderr=true

View File

@@ -58,7 +58,7 @@ data:
autostart = true autostart = true
autorestart = true autorestart = true
stopwaitsecs = 5 stopwaitsecs = 5
stopsignal=KILL stopsignal=TERM
stopasgroup=true stopasgroup=true
killasgroup=true killasgroup=true
redirect_stderr=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 autostart = true
autorestart = true autorestart = true
stopwaitsecs = 5 stopwaitsecs = 5
stopsignal=KILL stopsignal=TERM
stopasgroup=true stopasgroup=true
killasgroup=true killasgroup=true
redirect_stderr=true redirect_stderr=true