]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove _extract_roles method from neutron.policy
authorSalvatore Orlando <salv.orlando@gmail.com>
Mon, 24 Aug 2015 09:31:45 +0000 (02:31 -0700)
committerArmando Migliaccio <armamig@gmail.com>
Fri, 4 Sep 2015 22:21:26 +0000 (22:21 +0000)
This method is not used anymore as it was called only from
the get_admin_roles method. This method has been removed
by commit 734e77365b0f241a3cea0f3c9dfb1d5fcf6eac8c; therefore
the _extract_roles method is now zombie code and should be
removed before it starts feeding on Neutron's brain.

Related-Bug: #1445690

Change-Id: I0306bcea813031897e319af9693e18d03848e378

neutron/policy.py

index e1d955a60229333cf2f8d335d32c763b5fe43cb9..d3bc5c6318de68915a09f19d8ccb9c9563237042 100644 (file)
@@ -411,13 +411,3 @@ def check_is_advsvc(context):
     if ADVSVC_CTX_POLICY not in _ENFORCER.rules:
         return False
     return _ENFORCER.enforce(ADVSVC_CTX_POLICY, credentials, credentials)
-
-
-def _extract_roles(rule, roles):
-    if isinstance(rule, policy.RoleCheck):
-        roles.append(rule.match.lower())
-    elif isinstance(rule, policy.RuleCheck):
-        _extract_roles(_ENFORCER.rules[rule.match], roles)
-    elif hasattr(rule, 'rules'):
-        for rule in rule.rules:
-            _extract_roles(rule, roles)