Require topics and target in notify driver constructors

Pointed out by Doug.
This commit is contained in:
Mark McLoughlin 2013-05-31 16:25:51 +01:00
parent 4ede9a9178
commit a81e840cd5
2 changed files with 5 additions and 6 deletions

View File

@ -17,7 +17,7 @@
from openstack.common.gettextutils import _
from openstack.common import log as logging
from openstack.common.messaging
from openstack.common import messaging
from openstack.common.messaging.notify import notifier
LOG = logging.getLogger(__name__)
@ -25,9 +25,7 @@ LOG = logging.getLogger(__name__)
class MessagingDriver(notifier._Driver):
def __init__(self, conf, topics=None, transport=None, envelope=False):
if transport is None:
transport = messaging.get_transport(conf)
def __init__(self, conf, topics, transport, envelope=False):
super(MessagingDriver, self).__init__(conf, topics, transport)
self.envelope = envelope

View File

@ -21,6 +21,7 @@ from oslo.config import cfg
from stevedore import driver
from openstack.common.gettextutils import _
from openstack.common import messaging
from openstack.common import timeutils
from openstack.common import uuidutils
@ -40,7 +41,7 @@ class _Driver(object):
__metaclass__ = abc.ABCMeta
def __init__(self, conf, topics=None, transport=None):
def __init__(self, conf, topics, transport):
self.conf = conf
self.topics = topics
self.transport = transport
@ -64,7 +65,7 @@ class Notifier(object):
self._drivers = None
self._topics = ([topic] if topic is not None
else conf.notification_topics)
self._transport = transport
self._transport = transport or messaging.get_transport(conf)
def _get_drivers(self):
if self._drivers is not None: