Avoid storing configuration in notifier
The notifier itself doesn't use the configuration. So let's not store it, that lights the dependency a bit on this configuration object. Blueprint: messaging-decouple-cfg Change-Id: Ic4b5ddd93ea0382bd8292f9e31b7dacba9b489d3
This commit is contained in:
parent
010163d8ee
commit
41c629dc03
@ -110,24 +110,23 @@ class Notifier(object):
|
|||||||
:param serializer: an optional entity serializer
|
:param serializer: an optional entity serializer
|
||||||
:type serializer: Serializer
|
:type serializer: Serializer
|
||||||
"""
|
"""
|
||||||
self.conf = transport.conf
|
transport.conf.register_opts(_notifier_opts)
|
||||||
self.conf.register_opts(_notifier_opts)
|
|
||||||
|
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
self.publisher_id = publisher_id
|
self.publisher_id = publisher_id
|
||||||
|
|
||||||
self._driver_names = ([driver] if driver is not None
|
self._driver_names = ([driver] if driver is not None
|
||||||
else self.conf.notification_driver)
|
else transport.conf.notification_driver)
|
||||||
|
|
||||||
self._topics = ([topic] if topic is not None
|
self._topics = ([topic] if topic is not None
|
||||||
else self.conf.notification_topics)
|
else transport.conf.notification_topics)
|
||||||
self._serializer = serializer or msg_serializer.NoOpSerializer()
|
self._serializer = serializer or msg_serializer.NoOpSerializer()
|
||||||
|
|
||||||
self._driver_mgr = named.NamedExtensionManager(
|
self._driver_mgr = named.NamedExtensionManager(
|
||||||
'oslo.messaging.notify.drivers',
|
'oslo.messaging.notify.drivers',
|
||||||
names=self._driver_names,
|
names=self._driver_names,
|
||||||
invoke_on_load=True,
|
invoke_on_load=True,
|
||||||
invoke_args=[self.conf],
|
invoke_args=[transport.conf],
|
||||||
invoke_kwds={
|
invoke_kwds={
|
||||||
'topics': self._topics,
|
'topics': self._topics,
|
||||||
'transport': self.transport,
|
'transport': self.transport,
|
||||||
@ -251,7 +250,6 @@ class _SubNotifier(Notifier):
|
|||||||
|
|
||||||
def __init__(self, base, publisher_id):
|
def __init__(self, base, publisher_id):
|
||||||
self._base = base
|
self._base = base
|
||||||
self.conf = base.conf
|
|
||||||
self.transport = base.transport
|
self.transport = base.transport
|
||||||
self.publisher_id = publisher_id
|
self.publisher_id = publisher_id
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user