From 88f4577d52890f5710758f9c4f3923cbfe89f9ab Mon Sep 17 00:00:00 2001 From: wanghong Date: Mon, 21 Jul 2014 17:46:54 +0800 Subject: [PATCH] add internal delete notification for endpoint I think endpoint is not an important resource which other projects would pay close attention to. So I think an internal notification is enough. Change-Id: Ie42f2c867ea70fd41583151da0be19b9db682dad Closes-Bug: #1337763 --- keystone/catalog/core.py | 3 +++ keystone/tests/test_notifications.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py index 565f353851..f5bd49611c 100644 --- a/keystone/catalog/core.py +++ b/keystone/catalog/core.py @@ -25,6 +25,7 @@ from keystone.common import manager from keystone import config from keystone import exception from keystone.i18n import _ +from keystone import notifications from keystone.openstack.common import log @@ -66,6 +67,7 @@ class Manager(manager.Manager): dynamically calls the backend. """ + _ENDPOINT = 'endpoint' def __init__(self): super(Manager, self).__init__(CONF.catalog.driver) @@ -129,6 +131,7 @@ class Manager(manager.Manager): service_id = endpoint_ref.get('service_id') raise exception.ServiceNotFound(service_id=service_id) + @notifications.deleted(_ENDPOINT, public=False) def delete_endpoint(self, endpoint_id): try: return self.driver.delete_endpoint(endpoint_id) diff --git a/keystone/tests/test_notifications.py b/keystone/tests/test_notifications.py index 6a0d9bb127..d93e9f5625 100644 --- a/keystone/tests/test_notifications.py +++ b/keystone/tests/test_notifications.py @@ -308,6 +308,13 @@ class NotificationsForEntities(test_v3.RestfulTestCase): self.assignment_api.delete_domain(domain_ref['id']) self._assertLastNotify(domain_ref['id'], DELETED_OPERATION, 'domain') + def test_delete_endpoint(self): + endpoint_ref = self.new_endpoint_ref(service_id=self.service_id) + self.catalog_api.create_endpoint(endpoint_ref['id'], endpoint_ref) + self.catalog_api.delete_endpoint(endpoint_ref['id']) + self._assertNotifySent(endpoint_ref['id'], DELETED_OPERATION, + 'endpoint', public=False) + def test_disable_domain(self): domain_ref = self.new_domain_ref() self.assignment_api.create_domain(domain_ref['id'], domain_ref)