Remove registry.subscribe()

registry.subscribe() was marked deprecated for Ocata, remove it
now that we're in Rocky.


Change-Id: Ibdfa39dfb569a804b7612a17516dc41a0a8879bc
Brian Haley 5 years ago
parent 3c0d24fe6b
commit 5309cd5660

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import debtcollector
from neutron.api.rpc.callbacks import resource_manager
@ -21,19 +19,6 @@ def _get_manager():
return resource_manager.ConsumerResourceCallbacksManager()
message="This will be removed in the future. Please register callbacks "
"using the 'register' method in this model and adjust the "
"callback to accept the context and resource type as arguments.",
def subscribe(callback, resource_type):
# temporary hack to differentiate between callback types until the
# 'subscribe' method is removed
callback.__dict__['_ACCEPTS_CONTEXT'] = False
_get_manager().register(callback, resource_type)
def register(callback, resource_type):
# TODO(kevinbenton): remove this on debt collection
callback.__dict__['_ACCEPTS_CONTEXT'] = True

@ -21,12 +21,6 @@ class ConsumerRegistryTestCase(base.BaseTestCase):
def test__get_manager_is_singleton(self):
self.assertIs(registry._get_manager(), registry._get_manager())
@mock.patch.object(registry, '_get_manager')
def test_subscribe(self, manager_mock):
callback = lambda: None
registry.subscribe(callback, 'TYPE')
manager_mock().register.assert_called_with(callback, 'TYPE')
@mock.patch.object(registry, '_get_manager')
def test_register(self, manager_mock):
callback = lambda: None
@ -53,14 +47,11 @@ class ConsumerRegistryTestCase(base.BaseTestCase):
context = mock.Mock()
callback1 = mock.Mock()
callback2 = mock.Mock()
legacy_callback = mock.Mock()
registry.register(callback1, 'x')
registry.register(callback2, 'x')
registry.subscribe(legacy_callback, 'x')
callbacks = {callback1, callback2, legacy_callback}
callbacks = {callback1, callback2}
manager_mock().get_callbacks.return_value = callbacks
registry.push(context, resource_type_, [resource_], event_type_)
for callback in (callback1, callback2):
callback.assert_called_with(context, resource_type_,
[resource_], event_type_)
legacy_callback.assert_called_with([resource_], event_type_)