From 804be5979569cc64dfef2ac2b6bc0c040d313aa0 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 9 Aug 2016 15:56:11 +1000 Subject: [PATCH] Revert "Adds debug logging for policy file validation" 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 --- oslo_policy/policy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py index 46c2362e..342bf01e 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)