Fix nova probes under python3

Under python3 an Exception no longer has the message attribute,
instead you can just str the exception to get the error message

Change-Id: Ibf88ae6b73f3bafcc2b99bb01e31bf8c25021e47
This commit is contained in:
Itxaka 2019-03-20 13:09:37 +01:00
parent b9bc466535
commit d4e882b04a
No known key found for this signature in database
GPG Key ID: 0FFB0E56C3539E24

View File

@ -61,8 +61,9 @@ def check_service_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 service
else:
sys.stderr.write("Health probe unable to reach service")
@ -72,8 +73,9 @@ def check_service_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 "
"service: %s" % ex.message)
"service: %s" % message)
sys.exit(0)
except:
sys.stderr.write("Health probe caught exception sending message to"
@ -180,7 +182,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 \