Remove i18n.enable_lazy() call from senlin.cmd

Lazy translation of messages is not used in OpenStack. This
causes problems for commands which use translatable messages.
The lazy translation effort was abandoned several years ago.

Change-Id: I8fd7cf1234fcc80b4e1678379ee8170c6e7a1ca8
Related-Bug: #1801761
This commit is contained in:
Matt Riedemann 2018-11-05 11:55:52 -05:00
parent 66a3b2ffeb
commit e8633adf31
6 changed files with 2 additions and 37 deletions

View File

@ -1,15 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import oslo_i18n
oslo_i18n.enable_lazy()

View File

@ -18,7 +18,6 @@ Senlin API Server.
import sys
from oslo_config import cfg
from oslo_i18n import _lazy
from oslo_log import log as logging
from oslo_service import systemd
import six
@ -30,8 +29,6 @@ from senlin.common import profiler
from senlin import objects
from senlin import version
_lazy.enable_lazy()
LOG = logging.getLogger('senlin.api')

View File

@ -19,7 +19,6 @@ Use this file for deploying senlin-api under Apache2(mode-wsgi).
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
from senlin.api.common import wsgi
@ -30,8 +29,6 @@ from senlin import version
def init_app():
i18n.enable_lazy()
logging.register_options(cfg.CONF)
cfg.CONF(project='senlin', prog='senlin-api',
version=version.version_info.version_string())

View File

@ -16,7 +16,6 @@
Senlin Engine Server.
"""
from oslo_config import cfg
from oslo_i18n import _lazy
from oslo_log import log as logging
from oslo_service import service
@ -25,8 +24,6 @@ from senlin.common import messaging
from senlin.common import profiler
from senlin import objects
_lazy.enable_lazy()
def main():
logging.register_options(cfg.CONF)

View File

@ -216,7 +216,8 @@ class InternalError(SenlinException):
def __init__(self, **kwargs):
self.code = kwargs.pop('code', 500)
self.message = kwargs.pop('message', self.message)
# If a "message" is not provided, or None or blank, use the default.
self.message = kwargs.pop('message', self.message) or self.message
super(InternalError, self).__init__(
code=self.code, message=self.message, **kwargs)

View File

@ -11,21 +11,9 @@
# under the License.
import eventlet
import oslo_i18n
from senlin import objects
def fake_translate_msgid(msgid, domain, desired_locale=None):
return msgid
oslo_i18n.enable_lazy()
# To ensure messages don't really get translated while running tests.
# As there are lots of places where matching is expected when comparing
# exception message(translated) with raw message.
oslo_i18n._translate_msgid = fake_translate_msgid
eventlet.monkey_patch(os=False)
# The following has to be done after eventlet monkey patching or else the