From 424b6b98af582621b0eccb506c0bbe6f06d47b2a Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 20 Mar 2015 08:26:08 -0400 Subject: [PATCH] update oslo policy to remove policy.d log spam After oslo policy added config dirs it started spamming the logs relentlessly on if you didn't have a policy.d directory on your system. This is a very unfriendly upgrade to operators. A fix was provided in the incubator just before incubator policy was deleted. This syncs in that fix. Change-Id: Idf9c63c52561acdfe5463fee35dbc497c5e1fde5 Related-Bug: #1421863 --- cinder/openstack/common/policy.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cinder/openstack/common/policy.py b/cinder/openstack/common/policy.py index 7349ec949..871e7c226 100644 --- a/cinder/openstack/common/policy.py +++ b/cinder/openstack/common/policy.py @@ -95,14 +95,14 @@ import logging import os import re -from oslo.config import cfg -from oslo.serialization import jsonutils +from oslo_config import cfg +from oslo_serialization import jsonutils import six import six.moves.urllib.parse as urlparse import six.moves.urllib.request as urlrequest from cinder.openstack.common import fileutils -from cinder.openstack.common._i18n import _, _LE, _LI +from cinder.openstack.common._i18n import _, _LE policy_opts = [ @@ -120,7 +120,8 @@ policy_opts = [ 'in the search path defined by the config_dir ' 'option, or absolute paths. The file defined by ' 'policy_file must exist for these directories to ' - 'be searched.')), + 'be searched. Missing or empty directories are ' + 'ignored.')), ] CONF = cfg.CONF @@ -132,7 +133,7 @@ _checks = {} def list_opts(): - """Entry point for oslo.config-generator.""" + """Entry point for oslo-config-generator.""" return [(None, copy.deepcopy(policy_opts))] @@ -272,7 +273,6 @@ class Enforcer(object): try: path = self._get_policy_path(path) except cfg.ConfigFilesNotFoundError: - LOG.info(_LI("Can not find policy directory: %s"), path) continue self._walk_through_policy_directory(path, self._load_policy_file, @@ -292,7 +292,8 @@ class Enforcer(object): if reloaded or not self.rules or not overwrite: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules, overwrite=overwrite, use_conf=True) - LOG.debug("Rules successfully reloaded") + LOG.debug("Reloaded policy file: %(path)s", + {'path': path}) def _get_policy_path(self, path): """Locate the policy json data file/path. -- 2.45.2