mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
an an rsyslogd config check to the logging test endpoint
This commit is contained in:
parent
2a4b009f04
commit
1000dc10fb
@ -4,6 +4,7 @@
|
|||||||
# Python
|
# Python
|
||||||
import collections
|
import collections
|
||||||
import logging
|
import logging
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
from socket import SHUT_RDWR
|
from socket import SHUT_RDWR
|
||||||
@ -173,6 +174,14 @@ class SettingLoggingTest(GenericAPIView):
|
|||||||
|
|
||||||
hostname = getattr(settings, 'LOG_AGGREGATOR_HOST', None)
|
hostname = getattr(settings, 'LOG_AGGREGATOR_HOST', None)
|
||||||
protocol = getattr(settings, 'LOG_AGGREGATOR_PROTOCOL', None)
|
protocol = getattr(settings, 'LOG_AGGREGATOR_PROTOCOL', None)
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.check_output(
|
||||||
|
['rsyslogd', '-N1', '-f', '/var/lib/awx/rsyslog/rsyslog.conf'],
|
||||||
|
stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError as exc:
|
||||||
|
return Response({'error': exc.output}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Check to ensure port is open at host
|
# Check to ensure port is open at host
|
||||||
if protocol in ['udp', 'tcp']:
|
if protocol in ['udp', 'tcp']:
|
||||||
|
Loading…
Reference in New Issue
Block a user