Exception: message need '_' function
eventlet_backdoor.py loopingcall.py service.py Change-Id: I41bf13a2c6afddbffe30ff36134c4a42eaa2ccf1
This commit is contained in:
parent
6a56ec63bf
commit
9b82953871
@ -28,7 +28,7 @@ import traceback
|
|||||||
import eventlet.backdoor
|
import eventlet.backdoor
|
||||||
import greenlet
|
import greenlet
|
||||||
|
|
||||||
from oslo_service._i18n import _LI
|
from oslo_service._i18n import _LI, _
|
||||||
from oslo_service import _options
|
from oslo_service import _options
|
||||||
|
|
||||||
|
|
||||||
@ -37,8 +37,8 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EventletBackdoorConfigValueError(Exception):
|
class EventletBackdoorConfigValueError(Exception):
|
||||||
def __init__(self, port_range, help_msg, ex):
|
def __init__(self, port_range, help_msg, ex):
|
||||||
msg = ('Invalid backdoor_port configuration %(range)s: %(ex)s. '
|
msg = (_('Invalid backdoor_port configuration %(range)s: %(ex)s. '
|
||||||
'%(help)s' %
|
'%(help)s') %
|
||||||
{'range': port_range, 'ex': ex, 'help': help_msg})
|
{'range': port_range, 'ex': ex, 'help': help_msg})
|
||||||
super(EventletBackdoorConfigValueError, self).__init__(msg)
|
super(EventletBackdoorConfigValueError, self).__init__(msg)
|
||||||
self.port_range = port_range
|
self.port_range = port_range
|
||||||
@ -220,7 +220,7 @@ def _main():
|
|||||||
|
|
||||||
where_running_thread = _initialize_if_enabled(conf)
|
where_running_thread = _initialize_if_enabled(conf)
|
||||||
if not where_running_thread:
|
if not where_running_thread:
|
||||||
raise RuntimeError("Did not create backdoor at requested location")
|
raise RuntimeError(_("Did not create backdoor at requested location"))
|
||||||
else:
|
else:
|
||||||
_where_running, thread = where_running_thread
|
_where_running, thread = where_running_thread
|
||||||
thread.wait()
|
thread.wait()
|
||||||
|
@ -263,9 +263,9 @@ class BackOffLoopingCall(LoopingCallBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_RNG = random.SystemRandom()
|
_RNG = random.SystemRandom()
|
||||||
_KIND = 'Dynamic backoff interval looping call'
|
_KIND = _('Dynamic backoff interval looping call')
|
||||||
_RUN_ONLY_ONE_MESSAGE = ("A dynamic backoff interval looping call can"
|
_RUN_ONLY_ONE_MESSAGE = _("A dynamic backoff interval looping call can"
|
||||||
" only run one function at a time")
|
" only run one function at a time")
|
||||||
|
|
||||||
def __init__(self, f=None, *args, **kw):
|
def __init__(self, f=None, *args, **kw):
|
||||||
super(BackOffLoopingCall, self).__init__(f=f, *args, **kw)
|
super(BackOffLoopingCall, self).__init__(f=f, *args, **kw)
|
||||||
|
@ -35,7 +35,7 @@ from eventlet import event
|
|||||||
|
|
||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
from oslo_service import eventlet_backdoor
|
from oslo_service import eventlet_backdoor
|
||||||
from oslo_service._i18n import _LE, _LI, _LW
|
from oslo_service._i18n import _LE, _LI, _LW, _
|
||||||
from oslo_service import _options
|
from oslo_service import _options
|
||||||
from oslo_service import systemd
|
from oslo_service import systemd
|
||||||
from oslo_service import threadgroup
|
from oslo_service import threadgroup
|
||||||
@ -81,7 +81,7 @@ def _is_sighup_and_daemon(signo):
|
|||||||
|
|
||||||
def _check_service_base(service):
|
def _check_service_base(service):
|
||||||
if not isinstance(service, ServiceBase):
|
if not isinstance(service, ServiceBase):
|
||||||
raise TypeError("Service %(service)s must an instance of %(base)s!"
|
raise TypeError(_("Service %(service)s must an instance of %(base)s!")
|
||||||
% {'service': service, 'base': ServiceBase})
|
% {'service': service, 'base': ServiceBase})
|
||||||
|
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ def launch(conf, service, workers=1):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if workers is not None and workers <= 0:
|
if workers is not None and workers <= 0:
|
||||||
raise ValueError("Number of workers should be positive!")
|
raise ValueError(_("Number of workers should be positive!"))
|
||||||
|
|
||||||
if workers is None or workers == 1:
|
if workers is None or workers == 1:
|
||||||
launcher = ServiceLauncher(conf)
|
launcher = ServiceLauncher(conf)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user