mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 17:28:51 -03:30
Send SIGKILL to rsyslog if hard cancellation is needed
This commit is contained in:
@@ -11,10 +11,12 @@ def write_stdout(s):
|
|||||||
sys.stdout.write(s)
|
sys.stdout.write(s)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
def write_stderr(s):
|
def write_stderr(s):
|
||||||
sys.stderr.write(s)
|
sys.stderr.write(f"[rsyslog-4xx-recovery] {s}")
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
while 1:
|
while 1:
|
||||||
write_stdout("READY\n")
|
write_stdout("READY\n")
|
||||||
@@ -47,6 +49,15 @@ def main():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
write_stderr(str(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")
|
write_stdout("RESULT 2\nOK")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user