Remove unused code from cinderclient.utils module

_format_servers_list_networks method is not used anywhere.
It's safe to delete it.

We'ge got the same cinderclient.openstack.common.apiclient.HookableMixin
class so we don't need to duplicate it in the utils

Change-Id: Ifa7f5c1d00c1673811af48575460e6563d2d3180
This commit is contained in:
Ivan Kolodyazhny 2015-09-08 17:29:29 +03:00
parent 1c82825c41
commit df2883e040
3 changed files with 3 additions and 32 deletions

View File

@ -44,7 +44,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."""