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:
parent
886d8c6dab
commit
5d461fae60
@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='oslo_policy')
|
|||||||
|
|
||||||
# The primary translation function using the well-known name "_"
|
# The primary translation function using the well-known name "_"
|
||||||
_ = _translators.primary
|
_ = _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
|
|
||||||
|
@ -21,7 +21,6 @@ import re
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from oslo_policy import _checks
|
from oslo_policy import _checks
|
||||||
from oslo_policy._i18n import _LE
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -212,7 +211,7 @@ def _parse_check(rule):
|
|||||||
try:
|
try:
|
||||||
kind, match = rule.split(':', 1)
|
kind, match = rule.split(':', 1)
|
||||||
except Exception:
|
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
|
# If the rule is invalid, we'll fail closed
|
||||||
return _checks.FalseCheck()
|
return _checks.FalseCheck()
|
||||||
|
|
||||||
@ -222,7 +221,7 @@ def _parse_check(rule):
|
|||||||
elif None in _checks.registered_checks:
|
elif None in _checks.registered_checks:
|
||||||
return _checks.registered_checks[None](kind, match)
|
return _checks.registered_checks[None](kind, match)
|
||||||
else:
|
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()
|
return _checks.FalseCheck()
|
||||||
|
|
||||||
|
|
||||||
@ -338,7 +337,7 @@ def _parse_text_rule(rule):
|
|||||||
return state.result
|
return state.result
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Couldn't parse the rule
|
# Couldn't parse the rule
|
||||||
LOG.exception(_LE('Failed to understand rule %s'), rule)
|
LOG.exception('Failed to understand rule %s', rule)
|
||||||
|
|
||||||
# Fail closed
|
# Fail closed
|
||||||
return _checks.FalseCheck()
|
return _checks.FalseCheck()
|
||||||
|
@ -233,7 +233,6 @@ import yaml
|
|||||||
from oslo_policy import _cache_handler
|
from oslo_policy import _cache_handler
|
||||||
from oslo_policy import _checks
|
from oslo_policy import _checks
|
||||||
from oslo_policy._i18n import _
|
from oslo_policy._i18n import _
|
||||||
from oslo_policy._i18n import _LW
|
|
||||||
from oslo_policy import _parser
|
from oslo_policy import _parser
|
||||||
from oslo_policy import opts
|
from oslo_policy import opts
|
||||||
|
|
||||||
@ -570,11 +569,11 @@ class Enforcer(object):
|
|||||||
violation = True
|
violation = True
|
||||||
|
|
||||||
if undefined_checks:
|
if undefined_checks:
|
||||||
LOG.warning(_LW('Policies %(names)s reference a rule that is not '
|
LOG.warning('Policies %(names)s reference a rule that is not '
|
||||||
'defined.'), {'names': undefined_checks})
|
'defined.', {'names': undefined_checks})
|
||||||
if cyclic_checks:
|
if cyclic_checks:
|
||||||
LOG.warning(_LW('Policies %(names)s are part of a cyclical '
|
LOG.warning('Policies %(names)s are part of a cyclical '
|
||||||
'reference.'), {'names': cyclic_checks})
|
'reference.', {'names': cyclic_checks})
|
||||||
|
|
||||||
if raise_on_violation and violation:
|
if raise_on_violation and violation:
|
||||||
raise InvalidDefinitionError(undefined_checks + cyclic_checks)
|
raise InvalidDefinitionError(undefined_checks + cyclic_checks)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user