Fix failures when zmq is not available.

Observe a lot of crashes in services tests since 2.6.0 release.

Change-Id: I70e722e6553a9271b61dd54ffbba3f649d531b84
This commit is contained in:
Oleksii Zamiatin 2015-10-12 20:09:21 +03:00
parent 80e20243a5
commit 974f7d3a91

View File

@ -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]