Add more verbose on exit-event-listener.py. Fix python.
This commit is contained in:
parent
74413882fa
commit
53010bb1be
2 changed files with 8 additions and 2 deletions
|
|
@ -2,7 +2,8 @@ FROM haproxy:2.1-alpine
|
|||
|
||||
WORKDIR /scripts
|
||||
|
||||
RUN apk add --no-cache bash python3 py-yaml supervisor docker
|
||||
RUN apk add --no-cache bash python3 py-yaml supervisor docker \
|
||||
&& ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
COPY requirements.txt /scripts
|
||||
RUN pip3 install --upgrade pip \
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import signal
|
|||
|
||||
from supervisor import childutils
|
||||
|
||||
|
||||
def main():
|
||||
while True:
|
||||
headers, payload = childutils.listener.wait()
|
||||
|
|
@ -12,7 +13,11 @@ def main():
|
|||
events = ['PROCESS_STATE_FATAL', 'PROCESS_STATE_EXITED', 'PROCESS_STATE_STOPPED']
|
||||
if not (headers['eventname'] in events):
|
||||
continue
|
||||
|
||||
print(headers)
|
||||
print(payload)
|
||||
os.kill(os.getppid(), signal.SIGTERM)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue