diff --git a/cinderclient/base.py b/cinderclient/base.py index 1ee621ae9..6024f59c3 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -18,7 +18,7 @@ """ Base utilities to build API operation managers and objects on top of. """ - +import abc import contextlib import hashlib import os @@ -167,6 +167,12 @@ class ManagerWithFind(Manager): """ Like a `Manager`, but with additional `find()`/`findall()` methods. """ + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def list(self): + pass + def find(self, **kwargs): """ Find a single item with attributes matching ``**kwargs``. @@ -204,9 +210,6 @@ class ManagerWithFind(Manager): return found - def list(self): - raise NotImplementedError - class Resource(object): """ diff --git a/cinderclient/v1/quota_classes.py b/cinderclient/v1/quota_classes.py index 6aa4fdc40..caadd486f 100644 --- a/cinderclient/v1/quota_classes.py +++ b/cinderclient/v1/quota_classes.py @@ -28,7 +28,7 @@ class QuotaClassSet(base.Resource): self.manager.update(self.class_name, *args, **kwargs) -class QuotaClassSetManager(base.ManagerWithFind): +class QuotaClassSetManager(base.Manager): resource_class = QuotaClassSet def get(self, class_name): diff --git a/cinderclient/v1/quotas.py b/cinderclient/v1/quotas.py index 2ac22dfc3..846fb13b2 100644 --- a/cinderclient/v1/quotas.py +++ b/cinderclient/v1/quotas.py @@ -28,7 +28,7 @@ class QuotaSet(base.Resource): self.manager.update(self.tenant_id, *args, **kwargs) -class QuotaSetManager(base.ManagerWithFind): +class QuotaSetManager(base.Manager): resource_class = QuotaSet def get(self, tenant_id): diff --git a/cinderclient/v1/volume_backups_restore.py b/cinderclient/v1/volume_backups_restore.py index 9405f12ff..faf9e09bf 100644 --- a/cinderclient/v1/volume_backups_restore.py +++ b/cinderclient/v1/volume_backups_restore.py @@ -27,7 +27,7 @@ class VolumeBackupsRestore(base.Resource): return "" % self.id -class VolumeBackupRestoreManager(base.ManagerWithFind): +class VolumeBackupRestoreManager(base.Manager): """Manage :class:`VolumeBackupsRestore` resources.""" resource_class = VolumeBackupsRestore diff --git a/cinderclient/v2/quota_classes.py b/cinderclient/v2/quota_classes.py index d8b3e2f20..cc0b75320 100644 --- a/cinderclient/v2/quota_classes.py +++ b/cinderclient/v2/quota_classes.py @@ -27,7 +27,7 @@ class QuotaClassSet(base.Resource): self.manager.update(self.class_name, *args, **kwargs) -class QuotaClassSetManager(base.ManagerWithFind): +class QuotaClassSetManager(base.Manager): resource_class = QuotaClassSet def get(self, class_name): diff --git a/cinderclient/v2/quotas.py b/cinderclient/v2/quotas.py index 803d72cce..7c9db9006 100644 --- a/cinderclient/v2/quotas.py +++ b/cinderclient/v2/quotas.py @@ -27,7 +27,7 @@ class QuotaSet(base.Resource): self.manager.update(self.tenant_id, *args, **kwargs) -class QuotaSetManager(base.ManagerWithFind): +class QuotaSetManager(base.Manager): resource_class = QuotaSet def get(self, tenant_id): diff --git a/cinderclient/v2/volume_backups_restore.py b/cinderclient/v2/volume_backups_restore.py index 9405f12ff..faf9e09bf 100644 --- a/cinderclient/v2/volume_backups_restore.py +++ b/cinderclient/v2/volume_backups_restore.py @@ -27,7 +27,7 @@ class VolumeBackupsRestore(base.Resource): return "" % self.id -class VolumeBackupRestoreManager(base.ManagerWithFind): +class VolumeBackupRestoreManager(base.Manager): """Manage :class:`VolumeBackupsRestore` resources.""" resource_class = VolumeBackupsRestore