Merge "Fix neutron probes under python3"

This commit is contained in:
Zuul 2019-03-27 23:38:34 +00:00 committed by Gerrit Code Review
commit 6b82435cfe

View File

@ -67,8 +67,9 @@ def check_agent_status(transport):
sys.stderr.write("Health probe unable to reach message bus")
sys.exit(0) # return success
except oslo_messaging.rpc.client.RemoteError as re:
if ("Endpoint does not support RPC method" in re.message) or \
("Endpoint does not support RPC version" in re.message):
message = getattr(re, "message", str(re))
if ("Endpoint does not support RPC method" in message) or \
("Endpoint does not support RPC version" in message):
sys.exit(0) # Call reached the agent
else:
sys.stderr.write("Health probe unable to reach agent")
@ -78,8 +79,9 @@ def check_agent_status(transport):
"timed out")
sys.exit(1) # return failure
except Exception as ex:
message = getattr(ex, "message", str(ex))
sys.stderr.write("Health probe caught exception sending message to "
"agent: %s" % ex.message)
"agent: %s" % message)
sys.exit(0)
except:
sys.stderr.write("Health probe caught exception sending message to"
@ -202,12 +204,13 @@ def test_socket_liveness():
"Neutron Metadata agent: "
if se.strerror:
sys.stderr.write(msg + se.strerror)
elif se.message:
elif getattr(se, "message", False):
sys.stderr.write(msg + se.message)
sys.exit(1) # return failure
except Exception as ex:
message = getattr(ex, "message", str(ex))
sys.stderr.write("Health probe caught exception sending message to "
"Neutron Metadata agent: %s" % ex.message)
"Neutron Metadata agent: %s" % message)
sys.exit(0) # return success
if resp.status >= 500: # Probe expects HTTP error code 404
@ -233,7 +236,8 @@ def test_rpc_liveness():
try:
transport = oslo_messaging.get_transport(cfg.CONF)
except Exception as ex:
sys.stderr.write("Message bus driver load error: %s" % ex.message)
message = getattr(ex, "message", str(ex))
sys.stderr.write("Message bus driver load error: %s" % message)
sys.exit(0) # return success
if not cfg.CONF.transport_url or \