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
This commit is contained in:
wanghong 2014-07-21 17:46:54 +08:00
parent f9b40022d7
commit 88f4577d52
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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)