Implement keymgr list() method
Castellan KeyManager has added an abstract list() method starting in release 0.13.0. We are currently safe since upper constraints cap it at 0.12.0, but we will want to raise those constraints soon. This method isn't actually used in the Cinder code, but since it's an ABC abstract method we must implement it in our ConfKeyMgr. This just adds a basic skeleton so we don't blow up on missing the method. Change-Id: Ie2b2aef40b4de36d011c7efa0ab5af5c9581a63d Closes-bug: #1715451
This commit is contained in:
parent
9b6d70b226
commit
fa6951c55b
@ -144,3 +144,19 @@ class ConfKeyManager(key_manager.KeyManager):
|
||||
reason="cannot delete non-existent key")
|
||||
|
||||
LOG.warning("Not deleting key %s", managed_object_id)
|
||||
|
||||
def list(self, context, object_type=None, metadata_only=False):
|
||||
"""Retrieves a list of managed objects that match the criteria.
|
||||
|
||||
Note: Required abstract method starting with Castellan 0.13.0
|
||||
|
||||
:param context: Contains information of the user and the environment
|
||||
for the request.
|
||||
:param object_type: The type of object to retrieve.
|
||||
:param metadata_only: Whether secret data should be included.
|
||||
:raises NotAuthorized: If no user context.
|
||||
"""
|
||||
if context is None:
|
||||
raise exception.NotAuthorized()
|
||||
|
||||
return []
|
||||
|
@ -116,3 +116,11 @@ class ConfKeyManagerTestCase(test.TestCase):
|
||||
|
||||
def test_get_unknown_key(self):
|
||||
self.assertRaises(KeyError, self.key_mgr.get, self.ctxt, None)
|
||||
|
||||
def test_list(self):
|
||||
keys = self.key_mgr.list(self.ctxt)
|
||||
self.assertEqual(0, len(keys))
|
||||
|
||||
def test_list_null_context(self):
|
||||
self.assertRaises(exception.NotAuthorized,
|
||||
self.key_mgr.list, None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user