mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 15:02:07 -03:30
Send SIGKILL to rsyslog if hard cancellation is needed
This commit is contained in:
parent
b5f6aac3aa
commit
6440e3cb55
@ -11,10 +11,12 @@ def write_stdout(s):
|
||||
sys.stdout.write(s)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def write_stderr(s):
|
||||
sys.stderr.write(s)
|
||||
sys.stderr.write(f"[rsyslog-4xx-recovery] {s}")
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
def main():
|
||||
while 1:
|
||||
write_stdout("READY\n")
|
||||
@ -47,6 +49,15 @@ def main():
|
||||
except Exception as e:
|
||||
write_stderr(str(e))
|
||||
|
||||
if "action-0-omhttp queue: need to do hard cancellation" in log_message:
|
||||
try:
|
||||
write_stderr(
|
||||
f"{datetime.datetime.now(timezone.utc)} - sending SIGKILL to proc=[{proc_details['processname']}] with pid=[{int(proc_details['pid'])}] due to log_message=[{log_message}]\n"
|
||||
)
|
||||
os.kill(int(proc_details["pid"]), signal.SIGKILL)
|
||||
except Exception as e:
|
||||
write_stderr(str(e))
|
||||
|
||||
write_stdout("RESULT 2\nOK")
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user