From 974f7d3a91e2ed41f7f3fcc13ade4af3d720b888 Mon Sep 17 00:00:00 2001 From: Oleksii Zamiatin Date: Mon, 12 Oct 2015 20:09:21 +0300 Subject: [PATCH] Fix failures when zmq is not available. Observe a lot of crashes in services tests since 2.6.0 release. Change-Id: I70e722e6553a9271b61dd54ffbba3f649d531b84 --- .../_drivers/zmq_driver/zmq_names.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/oslo_messaging/_drivers/zmq_driver/zmq_names.py b/oslo_messaging/_drivers/zmq_driver/zmq_names.py index 0f3112e3b..a317456e7 100644 --- a/oslo_messaging/_drivers/zmq_driver/zmq_names.py +++ b/oslo_messaging/_drivers/zmq_driver/zmq_names.py @@ -17,15 +17,6 @@ from oslo_messaging._drivers.zmq_driver import zmq_async zmq = zmq_async.import_zmq() -ZMQ_SOCKET_STR = {zmq.DEALER: "DEALER", - zmq.ROUTER: "ROUTER", - zmq.PUSH: "PUSH", - zmq.PULL: "PULL", - zmq.REQ: "REQ", - zmq.REP: "REP", - zmq.PUB: "PUB", - zmq.SUB: "SUB"} - FIELD_FAILURE = 'failure' FIELD_REPLY = 'reply' FIELD_LOG_FAILURE = 'log_failure' @@ -51,4 +42,12 @@ NON_BLOCKING_TYPES = CAST_TYPES + NOTIFY_TYPES def socket_type_str(socket_type): - return ZMQ_SOCKET_STR[socket_type] + zmq_socket_str = {zmq.DEALER: "DEALER", + zmq.ROUTER: "ROUTER", + zmq.PUSH: "PUSH", + zmq.PULL: "PULL", + zmq.REQ: "REQ", + zmq.REP: "REP", + zmq.PUB: "PUB", + zmq.SUB: "SUB"} + return zmq_socket_str[socket_type]