summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Breeds <tony@bakeyournoodle.com>2016-08-09 15:56:11 +1000
committerTony Breeds <tony@bakeyournoodle.com>2016-08-09 16:04:19 +1000
commit804be5979569cc64dfef2ac2b6bc0c040d313aa0 (patch)
tree21f477b86e135763b423bfbc4c308afb199c4b35
parent1d2b26d7b5dda8868d821e1992e13e81c8b9d501 (diff)
downloadoslo-policy-804be5979569cc64dfef2ac2b6bc0c040d313aa0.tar.gz
Revert "Adds debug logging for policy file validation"1.14.0
This reverts commit 5273d2c3a15c8807d80547bdb88707ba69defc05. The commit in question more nearly doubles the .testrepository runs: -rw------- 1 stack stack 50M Aug 9 05:29 0 -rw------- 1 stack stack 36M Aug 9 05:46 1 0 == keystone py27 with olso.policy 1.13.0 1 == keystone py27 with olso.policy 1.12.0 This can be seen in the gate[1][2]. Revert the debuging change until it can be off by defult and used when needed. [1] http://logs.openstack.org/97/350197/2/check/gate-cross-keystone-python27-db-ubuntu-xenial/16c26fa/console.html#_2016-08-08_22_53_48_974404 [2] And it's preventing olso.policy 1.13.0 being used in upper-constraints.txt Change-Id: I19a73e8935976cc98398665306cc104b66719951
-rw-r--r--oslo_policy/policy.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py
index 46c2362..342bf01 100644
--- a/oslo_policy/policy.py
+++ b/oslo_policy/policy.py
@@ -343,7 +343,11 @@ class Rules(dict):
"""
parsed_file = parse_file_contents(data)
- return cls.from_dict(parsed_file, default_rule)
+
+ # Parse the rules
+ rules = {k: _parser.parse_rule(v) for k, v in parsed_file.items()}
+
+ return cls(rules, default_rule)
@classmethod
def load_json(cls, data, default_rule=None):
@@ -365,10 +369,7 @@ class Rules(dict):
"""Allow loading of rule data from a dictionary."""
# Parse the rules stored in the dictionary
- rules = dict()
- for k, v in rules_dict.items():
- LOG.debug('Processing policy: "%s": "%s"', k, v)
- rules[k] = _parser.parse_rule(v)
+ rules = {k: _parser.parse_rule(v) for k, v in rules_dict.items()}
return cls(rules, default_rule)