diff --git a/keystone/notifications.py b/keystone/notifications.py index 725bc8f86e..6f010211da 100644 --- a/keystone/notifications.py +++ b/keystone/notifications.py @@ -37,12 +37,10 @@ class ManagerNotificationWrapper(object): ``Exception`` (such as ``keystone.exception.NotFound``). :param resource_type: type of resource being affected - :param host: host of the resource (optional) """ - def __init__(self, operation, resource_type, host=None): + def __init__(self, operation, resource_type): self.operation = operation self.resource_type = resource_type - self.host = host def __call__(self, f): def wrapper(*args, **kwargs): @@ -55,8 +53,7 @@ class ManagerNotificationWrapper(object): _send_notification( self.operation, self.resource_type, - args[1], # f(self, resource_id, ...) - self.host) + args[1]) # f(self, resource_id, ...) return result return wrapper @@ -131,7 +128,7 @@ def notify_event_callbacks(service, resource_type, operation, payload): cb(service, resource_type, operation, payload) -def _send_notification(operation, resource_type, resource_id, host=None): +def _send_notification(operation, resource_type, resource_id): """Send notification to inform observers about the affected resource. This method doesn't raise an exception when sending the notification fails. @@ -139,12 +136,11 @@ def _send_notification(operation, resource_type, resource_id, host=None): :param operation: operation being performed (created, updated, or deleted) :param resource_type: type of resource being operated on :param resource_id: ID of resource being operated on - :param host: resource host """ context = {} payload = {'resource_info': resource_id} service = 'identity' - publisher_id = notifier_api.publisher_id(service, host=host) + publisher_id = notifier_api.publisher_id(service) event_type = '%(service)s.%(resource_type)s.%(operation)s' % { 'service': service, 'resource_type': resource_type, diff --git a/keystone/tests/test_notifications.py b/keystone/tests/test_notifications.py index b1befa2f91..5528fb39b1 100644 --- a/keystone/tests/test_notifications.py +++ b/keystone/tests/test_notifications.py @@ -37,14 +37,12 @@ class NotificationsWrapperTestCase(tests.TestCase): self.exp_resource_id = None self.exp_operation = None - self.exp_host = None self.send_notification_called = False - def fake_notify(operation, resource_type, resource_id, host=None): + def fake_notify(operation, resource_type, resource_id): self.assertEqual(self.exp_operation, operation) self.assertEqual(EXP_RESOURCE_TYPE, resource_type) self.assertEqual(self.exp_resource_id, resource_id) - self.assertEqual(self.exp_host, host) self.send_notification_called = True fixture = self.useFixture(moxstubout.MoxStubout()) @@ -62,7 +60,6 @@ class NotificationsWrapperTestCase(tests.TestCase): exp_resource_data = { 'id': self.exp_resource_id, 'key': uuid.uuid4().hex} - self.exp_host = None self.create_resource(self.exp_resource_id, exp_resource_data) self.assertTrue(self.send_notification_called) @@ -77,7 +74,6 @@ class NotificationsWrapperTestCase(tests.TestCase): exp_resource_data = { 'id': self.exp_resource_id, 'key': uuid.uuid4().hex} - self.exp_host = None self.update_resource(self.exp_resource_id, exp_resource_data) self.assertTrue(self.send_notification_called) @@ -89,7 +85,6 @@ class NotificationsWrapperTestCase(tests.TestCase): def test_resource_deleted_notification(self): self.exp_operation = 'deleted' self.exp_resource_id = uuid.uuid4().hex - self.exp_host = None self.delete_resource(self.exp_resource_id) self.assertTrue(self.send_notification_called) @@ -136,7 +131,6 @@ class NotificationsTestCase(tests.TestCase): resource = uuid.uuid4().hex resource_type = EXP_RESOURCE_TYPE operation = 'created' - host = None # NOTE(ldbragst): Even though notifications._send_notification doesn't # contain logic that creates cases, this is suppose to test that @@ -154,8 +148,7 @@ class NotificationsTestCase(tests.TestCase): self.assertEqual(exp_payload, payload) self.stubs.Set(notifier_api, 'notify', fake_notify) - notifications._send_notification(resource, resource_type, operation, - host=host) + notifications._send_notification(resource, resource_type, operation) class NotificationsForEntities(test_v3.RestfulTestCase): @@ -167,7 +160,7 @@ class NotificationsForEntities(test_v3.RestfulTestCase): self.exp_resource_type = None self.send_notification_called = False - def fake_notify(operation, resource_type, resource_id, host=None): + def fake_notify(operation, resource_type, resource_id): self.exp_resource_id = resource_id self.exp_operation = operation self.exp_resource_type = resource_type