Merge "Remove unused code from cinderclient.utils module"

This commit is contained in:
Jenkins 2015-10-21 16:00:58 +00:00 committed by Gerrit Code Review
commit 9ad10ab8a3
3 changed files with 3 additions and 32 deletions

View File

@ -52,7 +52,7 @@ def getid(obj):
return obj
class Manager(utils.HookableMixin):
class Manager(common_base.HookableMixin):
"""
Managers interact with a particular type of API (servers, flavors, images,
etc.) and provide CRUD operations for them.

View File

@ -14,10 +14,11 @@
# under the License.
from cinderclient import base
from cinderclient.openstack.common.apiclient import base as common_base
from cinderclient import utils
class Extension(utils.HookableMixin):
class Extension(common_base.HookableMixin):
"""Extension descriptor."""
SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__')

View File

@ -228,36 +228,6 @@ def find_volume(cs, volume):
return find_resource(cs.volumes, volume)
def _format_servers_list_networks(server):
output = []
for (network, addresses) in list(server.networks.items()):
if len(addresses) == 0:
continue
addresses_csv = ', '.join(addresses)
group = "%s=%s" % (network, addresses_csv)
output.append(group)
return '; '.join(output)
class HookableMixin(object):
"""Mixin so classes can register and run hooks."""
_hooks_map = {}
@classmethod
def add_hook(cls, hook_type, hook_func):
if hook_type not in cls._hooks_map:
cls._hooks_map[hook_type] = []
cls._hooks_map[hook_type].append(hook_func)
@classmethod
def run_hooks(cls, hook_type, *args, **kwargs):
hook_funcs = cls._hooks_map.get(hook_type) or []
for hook_func in hook_funcs:
hook_func(*args, **kwargs)
def safe_issubclass(*args):
"""Like issubclass, but will just return False if not a class."""