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
This commit is contained in:
loooosy 2017-03-21 14:22:55 +08:00 committed by Siyi Luo
parent 886d8c6dab
commit 5d461fae60
3 changed files with 7 additions and 19 deletions

View File

@ -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

View File

@ -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()

View File

@ -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)