Commit 7b2b2219 authored by Łukasz Nowak's avatar Łukasz Nowak

playbook: Check Zope availability before exposure

As frontend can be already available, but still not serving correct content
check that it returns ZMI (Zope Management Interface) before providing it
as working for the user.
parent 441a7a94
...@@ -131,7 +131,24 @@ def status(): ...@@ -131,7 +131,24 @@ def status():
frontend = 'https://' + ip frontend = 'https://' + ip
frontend_ip, _ = get_connection_information(frn_sr) frontend_ip, _ = get_connection_information(frn_sr)
if zope_ip is None or frontend is None or frontend_ip is None: connected = False
if frontend is not None:
# as frontend is already up, check if all is ready to serve requests
# before providing the access url to the user
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
try:
r1 = urllib2.urlopen(frontend, context=ctx)
if 'Zope Management Interface' in r1.read():
connected = True
else:
print 'URL %s ready, but does not reply with Zope' % frontend
except urllib2.URLError, e:
print "Zope not available yet: %s" % e
if zope_ip is None or frontend is None or frontend_ip is None or not connected:
print "Build successful, please wait for instantiation" print "Build successful, please wait for instantiation"
sys.exit(2) sys.exit(2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment