ConfFixture should work even when zmq/redis is not present
Previous driver and other locations in the code we used zmq_async.import_zmq() and importutils.try_import() to not fail fast when pyzmq and redis python packages are not installed. If we don't do this, we are going to break Nova/Cinder/Glance etc. Closes-Bug: #1503499 Change-Id: I1529241b5e1d902b37d6b610646a5a46a18f13b0
This commit is contained in:
parent
543d303bfd
commit
d9bb2f4b94
@ -18,12 +18,12 @@ import os
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
from stevedore import driver
|
||||
import zmq
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.broker import zmq_queue_proxy
|
||||
from oslo_messaging._drivers.zmq_driver import zmq_async
|
||||
from oslo_messaging._i18n import _LE, _LI
|
||||
|
||||
|
||||
zmq = zmq_async.import_zmq(zmq_concurrency='native')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
import logging
|
||||
|
||||
import six
|
||||
import zmq
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.broker import zmq_base_proxy
|
||||
from oslo_messaging._drivers.zmq_driver.client.publishers\
|
||||
@ -24,6 +23,7 @@ from oslo_messaging._drivers.zmq_driver import zmq_address
|
||||
from oslo_messaging._drivers.zmq_driver import zmq_async
|
||||
from oslo_messaging._i18n import _LI
|
||||
|
||||
zmq = zmq_async.import_zmq(zmq_concurrency='native')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
import logging
|
||||
|
||||
from oslo_config import cfg
|
||||
import redis
|
||||
from oslo_utils import importutils
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.matchmaker import base
|
||||
|
||||
|
||||
redis = importutils.try_import('redis')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -16,10 +16,12 @@ import logging
|
||||
import threading
|
||||
|
||||
from oslo_utils import eventletutils
|
||||
import zmq
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver import zmq_async
|
||||
from oslo_messaging._drivers.zmq_driver import zmq_poller
|
||||
|
||||
zmq = zmq_async.import_zmq(zmq_concurrency='native')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
_threading = threading
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.poller import green_poller
|
||||
from oslo_messaging._drivers.zmq_driver.poller import threading_poller
|
||||
from oslo_messaging._i18n import _, _LE
|
||||
from oslo_utils import importutils
|
||||
|
||||
@ -45,7 +43,10 @@ def get_poller(zmq_concurrency='eventlet'):
|
||||
_raise_error_if_invalid_config_value(zmq_concurrency)
|
||||
|
||||
if zmq_concurrency == 'eventlet' and _is_eventlet_zmq_available():
|
||||
from oslo_messaging._drivers.zmq_driver.poller import green_poller
|
||||
return green_poller.GreenPoller()
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.poller import threading_poller
|
||||
return threading_poller.ThreadingPoller()
|
||||
|
||||
|
||||
@ -53,7 +54,10 @@ def get_reply_poller(zmq_concurrency='eventlet'):
|
||||
_raise_error_if_invalid_config_value(zmq_concurrency)
|
||||
|
||||
if zmq_concurrency == 'eventlet' and _is_eventlet_zmq_available():
|
||||
from oslo_messaging._drivers.zmq_driver.poller import green_poller
|
||||
return green_poller.HoldReplyPoller()
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.poller import threading_poller
|
||||
return threading_poller.ThreadingPoller()
|
||||
|
||||
|
||||
@ -61,7 +65,10 @@ def get_executor(method, zmq_concurrency='eventlet'):
|
||||
_raise_error_if_invalid_config_value(zmq_concurrency)
|
||||
|
||||
if zmq_concurrency == 'eventlet' and _is_eventlet_zmq_available():
|
||||
from oslo_messaging._drivers.zmq_driver.poller import green_poller
|
||||
return green_poller.GreenExecutor(method)
|
||||
|
||||
from oslo_messaging._drivers.zmq_driver.poller import threading_poller
|
||||
return threading_poller.ThreadingExecutor(method)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user