Merge "Remove translation of log messages from ironic/api"

This commit is contained in:
Jenkins 2017-04-11 23:25:20 +00:00 committed by Gerrit Code Review
commit 2be449f03a
4 changed files with 12 additions and 16 deletions

View File

@ -25,7 +25,6 @@ from ironic.api.controllers.v1 import types
from ironic.api.controllers.v1 import utils as api_utils from ironic.api.controllers.v1 import utils as api_utils
from ironic.api import expose from ironic.api import expose
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _LW
from ironic.common import policy from ironic.common import policy
from ironic.common import states from ironic.common import states
from ironic.common import utils from ironic.common import utils
@ -119,10 +118,10 @@ class LookupController(rest.RestController):
if invalid_addresses: if invalid_addresses:
node_log = ('' if not node_uuid node_log = ('' if not node_uuid
else _LW('(Node UUID: %s)') % node_uuid) else '(Node UUID: %s)' % node_uuid)
LOG.warning(_LW('The following MAC addresses "%(addrs)s" are ' LOG.warning('The following MAC addresses "%(addrs)s" are '
'invalid and will be ignored by the lookup ' 'invalid and will be ignored by the lookup '
'request %(node)s'), 'request %(node)s',
{'addrs': ', '.join(invalid_addresses), {'addrs': ', '.join(invalid_addresses),
'node': node_log}) 'node': node_log})

View File

@ -23,7 +23,6 @@ import six
from six.moves import http_client from six.moves import http_client
from ironic.common import context from ironic.common import context
from ironic.common.i18n import _LW
from ironic.common import policy from ironic.common import policy
from ironic.conductor import rpcapi from ironic.conductor import rpcapi
from ironic.db import api as dbapi from ironic.db import api as dbapi
@ -48,19 +47,19 @@ def policy_deprecation_check():
str_rule = six.text_type(rule) str_rule = six.text_type(rule)
for deprecated, replacement in substitution_dict.items(): for deprecated, replacement in substitution_dict.items():
if re.search(r'\b%s\b' % deprecated, str_rule): if re.search(r'\b%s\b' % deprecated, str_rule):
LOG.warning(_LW( LOG.warning(
"Deprecated argument %(deprecated)s is used in policy " "Deprecated argument %(deprecated)s is used in policy "
"file rule (%(rule)s), please use %(replacement)s " "file rule (%(rule)s), please use %(replacement)s "
"argument instead. The possibility to use deprecated " "argument instead. The possibility to use deprecated "
"arguments will be removed in the Pike release."), "arguments will be removed in the Pike release.",
{'deprecated': deprecated, 'replacement': replacement, {'deprecated': deprecated, 'replacement': replacement,
'rule': str_rule}) 'rule': str_rule})
if deprecated == 'domain_name': if deprecated == 'domain_name':
LOG.warning(_LW( LOG.warning(
"Please note that user_domain_id is an ID of the " "Please note that user_domain_id is an ID of the "
"user domain, while the deprecated domain_name is " "user domain, while the deprecated domain_name is "
"its name. The policy rule has to be updated " "its name. The policy rule has to be updated "
"accordingly.")) "accordingly.")
CHECKED_DEPRECATED_POLICY_ARGS = True CHECKED_DEPRECATED_POLICY_ARGS = True

View File

@ -42,10 +42,8 @@ class AuthTokenMiddleware(auth_token.AuthProtocol):
self.public_api_routes = [re.compile(route_pattern_tpl % route_tpl) self.public_api_routes = [re.compile(route_pattern_tpl % route_tpl)
for route_tpl in api_routes] for route_tpl in api_routes]
except re.error as e: except re.error as e:
msg = _('Cannot compile public API routes: %s') % e raise exception.ConfigInvalid(
error_msg=_('Cannot compile public API routes: %s') % e)
LOG.error(msg)
raise exception.ConfigInvalid(error_msg=msg)
super(AuthTokenMiddleware, self).__init__(app, conf) super(AuthTokenMiddleware, self).__init__(app, conf)

View File

@ -27,7 +27,7 @@ from oslo_log import log
import six import six
import webob import webob
from ironic.common.i18n import _, _LE from ironic.common.i18n import _
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -76,7 +76,7 @@ class ParsableErrorMiddleware(object):
+ '\n'.join(app_iter) + '\n'.join(app_iter)
+ '</error_message>'))] + '</error_message>'))]
except et.ElementTree.ParseError as err: except et.ElementTree.ParseError as err:
LOG.error(_LE('Error parsing HTTP response: %s'), err) LOG.error('Error parsing HTTP response: %s', err)
body = ['<error_message>%s' % state['status_code'] body = ['<error_message>%s' % state['status_code']
+ '</error_message>'] + '</error_message>']
state['headers'].append(('Content-Type', 'application/xml')) state['headers'].append(('Content-Type', 'application/xml'))