From 000c07137988bea669925fac4d1e3ca0d19782a1 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Wed, 18 Apr 2018 21:25:44 +0000 Subject: [PATCH] Use the provider_api module in limit controller Last release we spent a bunch of time going through and updating the code base to use the keystone/common/provider_api.py module. It looks like the unified limit controller was missed through. This commit updates the unified limit controller to be consistent with the rest of the keystone in not using `self` to access other subsystems in keystone. Change-Id: I86fa5a6e889d24779b2451b8402d0e7bd92a64ba --- keystone/limit/controllers.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/keystone/limit/controllers.py b/keystone/limit/controllers.py index 1d690ecbc2..399ca6c888 100644 --- a/keystone/limit/controllers.py +++ b/keystone/limit/controllers.py @@ -12,11 +12,14 @@ # under the License. from keystone.common import controller +from keystone.common import provider_api from keystone.common import validation from keystone import exception from keystone.i18n import _ from keystone.limit import schema +PROVIDERS = provider_api.ProviderAPIs + class RegisteredLimitV3(controller.V3Controller): collection_name = 'registered_limits' @@ -83,7 +86,7 @@ class LimitV3(controller.V3Controller): validation.lazy_validate(schema.limit_create, limits) limits = [self._assign_unique_id(self._normalize_dict(limit)) for limit in limits] - refs = self.unified_limit_api.create_limits(limits) + refs = PROVIDERS.unified_limit_api.create_limits(limits) refs = LimitV3.wrap_collection(request.context_dict, refs) refs.pop("links") return refs @@ -91,7 +94,7 @@ class LimitV3(controller.V3Controller): @controller.protected() def update_limits(self, request, limits): validation.lazy_validate(schema.limit_update, limits) - refs = self.unified_limit_api.update_limits( + refs = PROVIDERS.unified_limit_api.update_limits( [self._normalize_dict(limit) for limit in limits]) refs = LimitV3.wrap_collection(request.context_dict, refs) refs.pop("links") @@ -107,12 +110,12 @@ class LimitV3(controller.V3Controller): project_id = context.project_id if project_id: hints.add_filter('project_id', project_id) - refs = self.unified_limit_api.list_limits(hints) + refs = PROVIDERS.unified_limit_api.list_limits(hints) return LimitV3.wrap_collection(request.context_dict, refs, hints=hints) @controller.protected() def get_limit(self, request, limit_id): - ref = self.unified_limit_api.get_limit(limit_id) + ref = PROVIDERS.unified_limit_api.get_limit(limit_id) # TODO(wxy): Add system-scope check. If the request is system-scoped, # it can get any limits. context = request.context @@ -127,4 +130,4 @@ class LimitV3(controller.V3Controller): @controller.protected() def delete_limit(self, request, limit_id): - return self.unified_limit_api.delete_limit(limit_id) + return PROVIDERS.unified_limit_api.delete_limit(limit_id)