summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@mirantis.com>2013-08-05 13:15:02 +0400
committerAlexander Gordeev <agordeev@mirantis.com>2013-08-07 11:32:40 +0400
commit64bb5e2f59ea2f37b3f5ab19b792bf36ce342a2f (patch)
treef4e50f59fa24e1f563e36f14ae552ab9b5893b52
parent96d1f887dda21b43ba4376187f31953dee6f5273 (diff)
downloadoslo-64bb5e2f59ea2f37b3f5ab19b792bf36ce342a2f.tar.gz
oslo-64bb5e2f59ea2f37b3f5ab19b792bf36ce342a2f.tar.xz
oslo-64bb5e2f59ea2f37b3f5ab19b792bf36ce342a2f.zip
Fix wrong argument in openstack common policy
Fully fixes wrong param passed to the exception constructor from oslo.config occurring in Enforcer._get_policy_path Closes-Bug: #1208397 Change-Id: I28b11178808b447555e6e6e63383904749c77b18
-rw-r--r--openstack/common/policy.py2
-rw-r--r--tests/unit/test_policy.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/openstack/common/policy.py b/openstack/common/policy.py
index 02335ca..ad9a90c 100644
--- a/openstack/common/policy.py
+++ b/openstack/common/policy.py
@@ -221,7 +221,7 @@ class Enforcer(object):
if policy_file:
return policy_file
- raise cfg.ConfigFilesNotFoundError(path=CONF.policy_file)
+ raise cfg.ConfigFilesNotFoundError((CONF.policy_file,))
def enforce(self, rule, target, creds, do_raise=False,
exc=None, *args, **kwargs):
diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py
index 2ccf71e..3d9e58d 100644
--- a/tests/unit/test_policy.py
+++ b/tests/unit/test_policy.py
@@ -208,6 +208,11 @@ class EnforcerTest(PolicyBaseTestCase):
self.assertEquals(self.enforcer.rules, {'test': 'test',
'test1': 'test1'})
+ def test_get_policy_path_raises_exc(self):
+ enforcer = policy.Enforcer(policy_file='raise_error.json')
+ self.assertRaises(cfg.ConfigFilesNotFoundError,
+ enforcer._get_policy_path)
+
class FakeCheck(policy.BaseCheck):
def __init__(self, result=None):