Skip to content

Commit

Permalink
Update openstack.common.policy from oslo
Browse files Browse the repository at this point in the history
To fix an issue about ConfigFilesNotFoundError.

Oslo commit is aae2b1c38801ac8f00f817a17b1b0916a8d7c2c3.

Closes-bug: #1236177
Change-Id: I24c1d80033fc8166e7b1de01499f6d247b166f88
  • Loading branch information
no2a authored and Steven Hardy committed Oct 11, 2013
1 parent f5b1d2f commit b14f780
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions heat/openstack/common/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _get_policy_path(self):
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):
Expand Down Expand Up @@ -404,7 +404,7 @@ def __call__(self, target, cred, enforcer):
"""

for rule in self.rules:
if not rule(target, cred):
if not rule(target, cred, enforcer):
return False

return True
Expand Down Expand Up @@ -447,9 +447,8 @@ def __call__(self, target, cred, enforcer):
"""

for rule in self.rules:
if rule(target, cred):
if rule(target, cred, enforcer):
return True

return False

def add_check(self, rule):
Expand Down Expand Up @@ -846,7 +845,13 @@ def __call__(self, target, creds, enforcer):
"""

# 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

0 comments on commit b14f780

Please sign in to comment.