]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix 'Inheritance-based rule deprecated' log warning
authorRushi Agrawal <rushi.agr@gmail.com>
Mon, 27 May 2013 14:18:12 +0000 (19:48 +0530)
committerRushi Agrawal <rushi.agr@gmail.com>
Mon, 27 May 2013 14:59:50 +0000 (20:29 +0530)
A warning message appears in Cinder logs which state that
inheritance-based rules are deprecated and use default
Brain instead of HttpBrain. It looks like HttpBrain class
doesnt have any difference from Brain class, so changing
all the instances of HttpBrain to Brain shouldn't affect
anything and removes this warning from logs.

Digging further, I found out that the policy engine has
gone through a major rework in Oslo and Nova, and I think
at some point of time in future, we will also be moving
to use the latest policy engine code. In that way of
thinking, I guess this fix is acceptable for now.
Reference: https://review.openstack.org/#/c/14122

Changed the brain from HttpBrain -> Brain, which makes the
warnings in the log disapper. A more comprehensive work will be
to pull the latest policy change code from Oslo.

Bug #1156608

Change-Id: I9f63ec4c41025042725db9b2e7c8ffa3d91e0596

cinder/policy.py
cinder/tests/test_policy.py
cinder/tests/test_volume.py

index 9b2b4defd14dfc959309acc29dfa054ea13e42c3..fcf1649ff39f412d7aea6e5dfeda349716be5ab2 100644 (file)
@@ -58,7 +58,7 @@ def init():
 
 def _set_brain(data):
     default_rule = FLAGS.policy_default_rule
-    policy.set_brain(policy.HttpBrain.load_json(data, default_rule))
+    policy.set_brain(policy.Brain.load_json(data, default_rule))
 
 
 def enforce(context, action, target):
index ed221a4ae4875a651594c9b1f0ffc7f17b3058ad..57795198ab480efbc9c9ba0b91e0587a10eea139 100644 (file)
@@ -82,7 +82,7 @@ class PolicyTestCase(test.TestCase):
             "example:uppercase_admin": [["role:ADMIN"], ["role:sysadmin"]],
         }
         # NOTE(vish): then overload underlying brain
-        common_policy.set_brain(common_policy.HttpBrain(rules))
+        common_policy.set_brain(common_policy.Brain(rules))
         self.context = context.RequestContext('fake', 'fake', roles=['member'])
         self.target = {}
 
@@ -170,7 +170,7 @@ class DefaultPolicyTestCase(test.TestCase):
         self.context = context.RequestContext('fake', 'fake')
 
     def _set_brain(self, default_rule):
-        brain = cinder.openstack.common.policy.HttpBrain(self.rules,
+        brain = cinder.openstack.common.policy.Brain(self.rules,
                                                          default_rule)
         cinder.openstack.common.policy.set_brain(brain)
 
index 55cd8a2564fdd551a5fd9460c00e021f7c476c26..f9ec0130268d45574d4628d67cd45ff6dd84d06a 100644 (file)
@@ -1307,7 +1307,7 @@ class VolumePolicyTestCase(test.TestCase):
         cinder.policy.reset()
 
     def _set_rules(self, rules):
-        cinder.common.policy.set_brain(cinder.common.policy.HttpBrain(rules))
+        cinder.common.policy.set_brain(cinder.common.policy.Brain(rules))
 
     def test_check_policy(self):
         self.mox.StubOutWithMock(cinder.policy, 'enforce')