Skip to content

Commit

Permalink
update oslo policy to remove policy.d log spam
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sdague committed Mar 20, 2015
1 parent d6d98e1 commit 424b6b9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cinder/openstack/common/policy.py
Expand Up @@ -95,14 +95,14 @@
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 = [
Expand All @@ -120,7 +120,8 @@
'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
Expand All @@ -132,7 +133,7 @@


def list_opts():
"""Entry point for oslo.config-generator."""
"""Entry point for oslo-config-generator."""
return [(None, copy.deepcopy(policy_opts))]


Expand Down Expand Up @@ -272,7 +273,6 @@ def load_rules(self, force_reload=False):
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,
Expand All @@ -292,7 +292,8 @@ def _load_policy_file(self, path, force_reload, overwrite=True):
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.
Expand Down

0 comments on commit 424b6b9

Please sign in to comment.