summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloooosy <syluo5695@fiberhome.com>2017-03-21 14:22:55 +0800
committerSiyi Luo <syluo5695@fiberhome.com>2017-03-22 14:13:15 +0000
commit5d461fae600e56066a71204f5316a01f1e4da981 (patch)
treed3ec4ce9d3a2c6221ad583ccd563f1c5b8da8046
parent886d8c6dabc05937be9fbec840fc3849badc55cd (diff)
downloadoslo-policy-5d461fae600e56066a71204f5316a01f1e4da981.tar.gz
Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I1201cab3686a3689c4d24d6da4ddef87fcd04f13
-rw-r--r--oslo_policy/_i18n.py10
-rw-r--r--oslo_policy/_parser.py7
-rw-r--r--oslo_policy/policy.py9
3 files changed, 7 insertions, 19 deletions
diff --git a/oslo_policy/_i18n.py b/oslo_policy/_i18n.py
index 87b3f5b..7d9edf3 100644
--- a/oslo_policy/_i18n.py
+++ b/oslo_policy/_i18n.py
@@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='oslo_policy')
# The primary translation function using the well-known name "_"
_ = _translators.primary
-
-# Translators for log levels.
-#
-# The abbreviated names are meant to reflect the usual use of a short
-# name like '_'. The "L" is for "log" and the other letter comes from
-# the level.
-_LI = _translators.log_info
-_LW = _translators.log_warning
-_LE = _translators.log_error
-_LC = _translators.log_critical
diff --git a/oslo_policy/_parser.py b/oslo_policy/_parser.py
index 2225c2d..e85c81f 100644
--- a/oslo_policy/_parser.py
+++ b/oslo_policy/_parser.py
@@ -21,7 +21,6 @@ import re
import six
from oslo_policy import _checks
-from oslo_policy._i18n import _LE
LOG = logging.getLogger(__name__)
@@ -212,7 +211,7 @@ def _parse_check(rule):
try:
kind, match = rule.split(':', 1)
except Exception:
- LOG.exception(_LE('Failed to understand rule %s'), rule)
+ LOG.exception('Failed to understand rule %s', rule)
# If the rule is invalid, we'll fail closed
return _checks.FalseCheck()
@@ -222,7 +221,7 @@ def _parse_check(rule):
elif None in _checks.registered_checks:
return _checks.registered_checks[None](kind, match)
else:
- LOG.error(_LE('No handler for matches of kind %s'), kind)
+ LOG.error('No handler for matches of kind %s', kind)
return _checks.FalseCheck()
@@ -338,7 +337,7 @@ def _parse_text_rule(rule):
return state.result
except ValueError:
# Couldn't parse the rule
- LOG.exception(_LE('Failed to understand rule %s'), rule)
+ LOG.exception('Failed to understand rule %s', rule)
# Fail closed
return _checks.FalseCheck()
diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py
index 4a5a879..211d6c9 100644
--- a/oslo_policy/policy.py
+++ b/oslo_policy/policy.py
@@ -233,7 +233,6 @@ import yaml
from oslo_policy import _cache_handler
from oslo_policy import _checks
from oslo_policy._i18n import _
-from oslo_policy._i18n import _LW
from oslo_policy import _parser
from oslo_policy import opts
@@ -570,11 +569,11 @@ class Enforcer(object):
violation = True
if undefined_checks:
- LOG.warning(_LW('Policies %(names)s reference a rule that is not '
- 'defined.'), {'names': undefined_checks})
+ LOG.warning('Policies %(names)s reference a rule that is not '
+ 'defined.', {'names': undefined_checks})
if cyclic_checks:
- LOG.warning(_LW('Policies %(names)s are part of a cyclical '
- 'reference.'), {'names': cyclic_checks})
+ LOG.warning('Policies %(names)s are part of a cyclical '
+ 'reference.', {'names': cyclic_checks})
if raise_on_violation and violation:
raise InvalidDefinitionError(undefined_checks + cyclic_checks)