mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Add failure event handler for supervisor process
This commit is contained in:
parent
d42ec44010
commit
4cb2e5aa02
24
tools/scripts/failure-event-handler
Executable file
24
tools/scripts/failure-event-handler
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
|
||||
def write_stdout(s):
|
||||
sys.stdout.write(s)
|
||||
sys.stdout.flush()
|
||||
|
||||
def write_stderr(s):
|
||||
sys.stderr.write(s)
|
||||
sys.stderr.flush()
|
||||
|
||||
def main():
|
||||
while 1:
|
||||
write_stdout('READY\n')
|
||||
line = sys.stdin.readline()
|
||||
headers = dict([ x.split(':') for x in line.split() ])
|
||||
headers.update(dict([ x.split(':') for x in sys.stdin.read(int(headers['len'])).split()]))
|
||||
if headers['eventname'] == 'PROCESS_STATE_FATAL':
|
||||
os.kill(os.getppid(), signal.SIGTERM)
|
||||
write_stdout('RESULT 2\nOK')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
x
Reference in New Issue
Block a user