]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
update oslo policy to remove policy.d log spam
authorSean Dague <sean@dague.net>
Fri, 20 Mar 2015 12:26:08 +0000 (08:26 -0400)
committerSean Dague <sean@dague.net>
Fri, 20 Mar 2015 12:26:08 +0000 (08:26 -0400)
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

index 7349ec949eaf0663bce8d42ff9ea4445a0d83693..871e7c226ed2e871f65a503bc1e6552814be6a8c 100644 (file)
@@ -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.