make reconfigure_rsyslog a task

Signed-off-by: jessicamack <jmack@redhat.com>
This commit is contained in:
jessicamack
2023-02-09 16:18:43 -05:00
committed by Hao Liu
parent b29f2f88d0
commit da004da68a
3 changed files with 9 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
import logging
import json
from django.core.management.base import BaseCommand
from django.conf import settings
from django.core.cache import cache
from awx.main.dispatch import pg_bus_conn
from awx.main.dispatch.worker.task import TaskWorker
from awx.main.utils.external_logging import reconfigure_rsyslog
logger = logging.getLogger('awx.main.rsyslog_configurer')
@@ -31,7 +33,8 @@ class Command(BaseCommand):
setting_keys = [k for k in dir(settings) if k.startswith('LOG_AGGREGATOR')]
cache.delete_many(setting_keys)
settings._awx_conf_memoizedcache.clear()
reconfigure_rsyslog()
body = json.loads(e.payload)
TaskWorker.run_callable(body)
except Exception:
# Log unanticipated exception in addition to writing to stderr to get timestamps and other metadata
logger.exception('Encountered unhandled error in rsyslog_configurer main loop')