mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
Change healthcheck from wget and grep to python with httplib
This commit is contained in:
@@ -270,17 +270,43 @@ spec:
|
|||||||
livenessProbe:
|
livenessProbe:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /usr/bin/python
|
||||||
- -c
|
- -c
|
||||||
- "wget -O - --header \"Authorization: Basic {{ ( rabbitmq_user + ':' + rabbitmq_password ) | b64encode }}\" http://localhost:15672/api/healthchecks/node | grep -qF \"{\\\"status\\\":\\\"ok\\\"}\""
|
- |
|
||||||
|
import httplib
|
||||||
|
import sys
|
||||||
|
conn=httplib.HTTPConnection('localhost:15672')
|
||||||
|
conn.request('GET', '/api/healthchecks/node', headers={'Authorization': 'Basic {{ ( rabbitmq_user + ':' + rabbitmq_password ) | b64encode }}' })
|
||||||
|
r1 = conn.getresponse()
|
||||||
|
if r1.status != 200:
|
||||||
|
sys.stderr.write('Received http error %i\n' % (r1.status))
|
||||||
|
sys.exit(1)
|
||||||
|
body = r1.read()
|
||||||
|
if body != '{"status":"ok"}':
|
||||||
|
sys.stderr.write('Received body: %s' % body)
|
||||||
|
sys.exit(2)
|
||||||
|
sys.exit(0)
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /usr/bin/python
|
||||||
- -c
|
- -c
|
||||||
- "wget -O - --header \"Authorization: Basic {{ ( rabbitmq_user + ':' + rabbitmq_password ) | b64encode }}\" http://localhost:15672/api/healthchecks/node | grep -qF \"{\\\"status\\\":\\\"ok\\\"}\""
|
- |
|
||||||
|
import httplib
|
||||||
|
import sys
|
||||||
|
conn=httplib.HTTPConnection('localhost:15672')
|
||||||
|
conn.request('GET', '/api/healthchecks/node', headers={'Authorization': 'Basic {{ ( rabbitmq_user + ':' + rabbitmq_password ) | b64encode }}' })
|
||||||
|
r1 = conn.getresponse()
|
||||||
|
if r1.status != 200:
|
||||||
|
sys.stderr.write('Received http error %i\n' % (r1.status))
|
||||||
|
sys.exit(1)
|
||||||
|
body = r1.read()
|
||||||
|
if body != '{"status":"ok"}':
|
||||||
|
sys.stderr.write('Received body: %s' % body)
|
||||||
|
sys.exit(2)
|
||||||
|
sys.exit(0)
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user