diff --git a/manilaclient/base.py b/manilaclient/base.py index 4204714b0..277305d18 100644 --- a/manilaclient/base.py +++ b/manilaclient/base.py @@ -258,7 +258,7 @@ class Resource(object): def __getattr__(self, k): if k not in self.__dict__: - #NOTE(bcwaldon): disallow lazy-loading if already loaded once + # NOTE(bcwaldon): disallow lazy-loading if already loaded once if not self.is_loaded(): self.get() return self.__getattr__(k) diff --git a/manilaclient/service_catalog.py b/manilaclient/service_catalog.py index e4d8d83a9..f9bb31cbe 100644 --- a/manilaclient/service_catalog.py +++ b/manilaclient/service_catalog.py @@ -47,7 +47,7 @@ class ServiceCatalog(object): raise manilaclient.exceptions.EndpointNotFound() # We don't always get a service catalog back ... - if not 'serviceCatalog' in self.catalog['access']: + if 'serviceCatalog' not in self.catalog['access']: return None # Full catalog ... diff --git a/manilaclient/shell.py b/manilaclient/shell.py index 4b072bc8d..4c3c662ff 100644 --- a/manilaclient/shell.py +++ b/manilaclient/shell.py @@ -54,7 +54,7 @@ class ManilaClientArgumentParser(argparse.ArgumentParser): exits. """ self.print_usage(sys.stderr) - #FIXME(lzyeval): if changes occur in argparse.ArgParser._check_value + # FIXME(lzyeval): if changes occur in argparse.ArgParser._check_value choose_from = ' (choose from' progparts = self.prog.partition(' ') self.exit(2, "error: %(errmsg)s\nTry '%(mainp)s help %(subp)s'" @@ -350,7 +350,7 @@ class OpenStackManilaShell(object): service_type = DEFAULT_MANILA_SERVICE_TYPE service_type = utils.get_service_type(args.func) or service_type - #FIXME(usrleon): Here should be restrict for project id same as + # FIXME(usrleon): Here should be restrict for project id same as # for os_username or os_password but for compatibility it is not. if not utils.isunauthenticated(args.func): diff --git a/manilaclient/v1/security_services.py b/manilaclient/v1/security_services.py index 96bebcbfc..2269e987f 100644 --- a/manilaclient/v1/security_services.py +++ b/manilaclient/v1/security_services.py @@ -125,7 +125,7 @@ class SecurityServiceManager(base.Manager): """ self._delete(RESOURCE_PATH % security_service) - def list(self, search_opts=None): + def list(self, detailed=False, search_opts=None): """Get a list of all security services. :rtype: list of :class:`SecurityService` @@ -140,6 +140,9 @@ class SecurityServiceManager(base.Manager): else: query_string = '' - path = RESOURCES_PATH + "%s" % query_string + if detailed: + path = RESOURCES_PATH + "/detail" + query_string + else: + path = RESOURCES_PATH + query_string return self._list(path, RESOURCES_NAME) diff --git a/manilaclient/v1/share_networks.py b/manilaclient/v1/share_networks.py index c12b2ffeb..d5e94c87c 100644 --- a/manilaclient/v1/share_networks.py +++ b/manilaclient/v1/share_networks.py @@ -151,7 +151,7 @@ class ShareNetworkManager(base.Manager): """ self._delete(RESOURCE_PATH % share_network) - def list(self, search_opts=None): + def list(self, detailed=False, search_opts=None): """Get a list of all share network. :rtype: list of :class:`NetworkInfo` @@ -166,6 +166,9 @@ class ShareNetworkManager(base.Manager): else: query_string = '' - path = RESOURCES_PATH + "%s" % query_string + if detailed: + path = RESOURCES_PATH + "/detail" + query_string + else: + path = RESOURCES_PATH + query_string return self._list(path, RESOURCES_NAME) diff --git a/tests/v1/test_security_services.py b/tests/v1/test_security_services.py index 08dd38939..5270ac55d 100644 --- a/tests/v1/test_security_services.py +++ b/tests/v1/test_security_services.py @@ -91,6 +91,14 @@ class SecurityServiceTest(unittest.TestCase): security_services.RESOURCES_PATH, security_services.RESOURCES_NAME) + def test_list_detailed(self): + with mock.patch.object(self.manager, '_list', + mock.Mock(return_value=None)): + self.manager.list(detailed=True) + self.manager._list.assert_called_once_with( + security_services.RESOURCES_PATH + '/detail', + security_services.RESOURCES_NAME) + def test_list_with_filters(self): filters = OrderedDict([('all_tenants', 1), ('status', 'ERROR'), diff --git a/tests/v1/test_share_networks.py b/tests/v1/test_share_networks.py index 40f9f9c40..972f110dc 100644 --- a/tests/v1/test_share_networks.py +++ b/tests/v1/test_share_networks.py @@ -70,6 +70,14 @@ class ShareNetworkTest(unittest.TestCase): share_networks.RESOURCES_PATH, share_networks.RESOURCES_NAME) + def test_list_detailed(self): + with mock.patch.object(self.manager, '_list', + mock.Mock(return_value=None)): + self.manager.list(detailed=True) + self.manager._list.assert_called_once_with( + share_networks.RESOURCES_PATH + '/detail', + share_networks.RESOURCES_NAME) + def test_list_with_filters(self): filters = OrderedDict([('all_tenants', 1), ('status', 'ERROR')]) expected_path = \