Translator functions cleanup part 4
This part fixes ironic/api, ironic/cmd, ironic/tests folders. Some modules use _ function for log translation, even when the translated string is passed to e.g. LOG.warn function. This patch fixes it, using translator functions appropriate for corresponding log levels. Translator functions, imported from ironic.openstack.common.gettextutils are now imported from ironic.common.i18n. Translator functions are imported the same way across all modules. All places that are changed conform to http://docs.openstack.org/developer/oslo.i18n/guidelines.html Partial-bug: #1364813 Change-Id: I92e5f0d50c3b507080fb95e81274a241558ce526
This commit is contained in:
parent
f80e85ef6d
commit
d8a237806d
@ -27,6 +27,7 @@ import webob
|
||||
from xml import etree as et
|
||||
|
||||
from ironic.common.i18n import _
|
||||
from ironic.common.i18n import _LE
|
||||
from ironic.openstack.common import log
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -78,7 +79,7 @@ class ParsableErrorMiddleware(object):
|
||||
+ '\n'.join(app_iter)
|
||||
+ '</error_message>'))]
|
||||
except et.ElementTree.ParseError as err:
|
||||
LOG.error(_('Error parsing HTTP response: %s') % err)
|
||||
LOG.error(_LE('Error parsing HTTP response: %s'), err)
|
||||
body = ['<error_message>%s' % state['status_code']
|
||||
+ '</error_message>']
|
||||
state['headers'].append(('Content-Type', 'application/xml'))
|
||||
|
@ -25,7 +25,7 @@ from six.moves import socketserver
|
||||
from wsgiref import simple_server
|
||||
|
||||
from ironic.api import app
|
||||
from ironic.common.i18n import _
|
||||
from ironic.common.i18n import _LI
|
||||
from ironic.common import service as ironic_service
|
||||
from ironic.openstack.common import log
|
||||
|
||||
@ -51,9 +51,9 @@ def main():
|
||||
server_class=ThreadedSimpleServer)
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
LOG.info(_("Serving on http://%(host)s:%(port)s") %
|
||||
LOG.info(_LI("Serving on http://%(host)s:%(port)s"),
|
||||
{'host': host, 'port': port})
|
||||
LOG.info(_("Configuration:"))
|
||||
LOG.info(_LI("Configuration:"))
|
||||
CONF.log_opt_values(LOG, logging.INFO)
|
||||
|
||||
try:
|
||||
|
@ -49,7 +49,7 @@ from oslo.db.sqlalchemy import utils as db_utils
|
||||
import sqlalchemy
|
||||
import sqlalchemy.exc
|
||||
|
||||
from ironic.common.i18n import _
|
||||
from ironic.common.i18n import _LE
|
||||
from ironic.common import utils
|
||||
from ironic.db.sqlalchemy import migration
|
||||
from ironic.db.sqlalchemy import models
|
||||
@ -169,8 +169,9 @@ class WalkVersionsMixin(object):
|
||||
if check:
|
||||
check(engine, data)
|
||||
except Exception:
|
||||
LOG.error(_("Failed to migrate to version %(version)s on engine "
|
||||
"%(engine)s") % {'version': version, 'engine': engine})
|
||||
LOG.error(_LE("Failed to migrate to version %(version)s on engine "
|
||||
"%(engine)s"),
|
||||
{'version': version, 'engine': engine})
|
||||
raise
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user