16 lines
713 B
Python
16 lines
713 B
Python
#!/usr/bin/env python3
|
|
"""Bounded verified-HTTPS readiness wait."""
|
|
import ssl,time,urllib.request
|
|
context=ssl.create_default_context(cafile='secrets/ca/ca.crt')
|
|
pending={'api':'https://localhost:8443/health/ready','grafana':'https://localhost:17400/api/health'}
|
|
deadline=time.monotonic()+120
|
|
while pending and time.monotonic()<deadline:
|
|
for name,url in list(pending.items()):
|
|
try:
|
|
with urllib.request.urlopen(url,context=context,timeout=2) as response:
|
|
if response.status==200:del pending[name]
|
|
except OSError:pass
|
|
if pending:time.sleep(1)
|
|
if pending:raise SystemExit('Readiness timeout: '+','.join(pending))
|
|
print('PASS verified HTTPS API and Grafana ready')
|