summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArata Notsu <notsu@virtualtech.jp>2013-10-07 15:18:58 +0900
committerSteven Hardy <shardy@redhat.com>2013-10-11 09:51:29 +0100
commitb14f780a7822c24e6ed5d73d8b39c8bc28d099c2 (patch)
treea28b1b8e7b070a985c568b3b7918e91c54393197
parentf5b1d2ff20a194e64ea55afc5a2faeea0f1b62d0 (diff)
downloadheat-b14f780a7822c24e6ed5d73d8b39c8bc28d099c2.tar.gz
Update openstack.common.policy from oslo
To fix an issue about ConfigFilesNotFoundError. Oslo commit is aae2b1c38801ac8f00f817a17b1b0916a8d7c2c3. Closes-bug: #1236177 Change-Id: I24c1d80033fc8166e7b1de01499f6d247b166f88
-rw-r--r--heat/openstack/common/policy.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/heat/openstack/common/policy.py b/heat/openstack/common/policy.py
index 64455444b..2070acb67 100644
--- a/heat/openstack/common/policy.py
+++ b/heat/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((self.policy_file,))
def enforce(self, rule, target, creds, do_raise=False,
exc=None, *args, **kwargs):
@@ -404,7 +404,7 @@ class AndCheck(BaseCheck):
"""
for rule in self.rules:
- if not rule(target, cred):
+ if not rule(target, cred, enforcer):
return False
return True
@@ -447,9 +447,8 @@ class OrCheck(BaseCheck):
"""
for rule in self.rules:
- if rule(target, cred):
+ if rule(target, cred, enforcer):
return True
-
return False
def add_check(self, rule):
@@ -846,7 +845,13 @@ class GenericCheck(Check):
"""
# TODO(termie): do dict inspection via dot syntax
- match = self.match % target
+ try:
+ match = self.match % target
+ except KeyError:
+ # While doing GenericCheck if key not
+ # present in Target return false
+ return False
+
if self.kind in creds:
return match == six.text_type(creds[self.kind])
return False