Remove log translations
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: I35f03250707b8103b6f6b12cb16a1ebcea2aa925 Signed-off-by: Ranler Cao <caoran@fiberhome.com> Closes-Bug: #1674547 Signed-off-by: Ranler Cao <caoran@fiberhome.com>
This commit is contained in:
parent
c4c4422601
commit
cadcd46d38
@ -37,9 +37,6 @@ from nova.compute import flavors
|
||||
from nova.compute import power_state
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LE
|
||||
from nova.i18n import _LI
|
||||
from nova.i18n import _LW
|
||||
from nova import objects
|
||||
from nova.objects import fields
|
||||
from nova import utils
|
||||
@ -427,16 +424,16 @@ class DockerDriver(driver.ComputeDriver):
|
||||
def _cleanup_instance_file(self, id):
|
||||
dir = os.path.join(CONF.instances_path, id)
|
||||
if os.path.exists(dir):
|
||||
LOG.info(_LI('Deleting instance files %s'), dir)
|
||||
LOG.info('Deleting instance files %s', dir)
|
||||
try:
|
||||
shutil.rmtree(dir)
|
||||
except OSError as e:
|
||||
LOG.error(_LE('Failed to cleanup directory %(target)s: '
|
||||
'%(e)s'), {'target': dir, 'e': e})
|
||||
LOG.error(('Failed to cleanup directory %(target)s: '
|
||||
'%(e)s'), {'target': dir, 'e': e})
|
||||
|
||||
def _neutron_failed_callback(self, event_name, instance):
|
||||
LOG.error(_LE('Neutron Reported failure on event '
|
||||
'%(event)s for instance %(uuid)s'),
|
||||
LOG.error(('Neutron Reported failure on event '
|
||||
'%(event)s for instance %(uuid)s'),
|
||||
{'event': event_name, 'uuid': instance.uuid},
|
||||
instance=instance)
|
||||
if CONF.vif_plugging_is_fatal:
|
||||
@ -469,8 +466,8 @@ class DockerDriver(driver.ComputeDriver):
|
||||
self.plug_vifs(instance, network_info)
|
||||
self._attach_vifs(instance, network_info)
|
||||
except eventlet.timeout.Timeout:
|
||||
LOG.warning(_LW('Timeout waiting for vif plugging callback for '
|
||||
'instance %(uuid)s'), {'uuid': instance['name']})
|
||||
LOG.warning(('Timeout waiting for vif plugging callback for '
|
||||
'instance %(uuid)s'), {'uuid': instance['name']})
|
||||
if CONF.vif_plugging_is_fatal:
|
||||
self.docker.kill(container_id)
|
||||
self.docker.remove_container(container_id, force=True)
|
||||
|
@ -20,7 +20,6 @@ import pecan
|
||||
from zun.api import config as api_config
|
||||
from zun.api import middleware
|
||||
from zun.common import config as common_config
|
||||
from zun.common.i18n import _LI
|
||||
import zun.conf
|
||||
|
||||
CONF = zun.conf.CONF
|
||||
@ -60,7 +59,7 @@ def load_app():
|
||||
|
||||
if not cfg_file:
|
||||
raise cfg.ConfigFilesNotFoundError([CONF.api.api_paste_config])
|
||||
LOG.info(_LI("Full WSGI config used: %s"), cfg_file)
|
||||
LOG.info("Full WSGI config used: %s", cfg_file)
|
||||
return deploy.loadapp("config:" + cfg_file)
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@ from oslo_utils import uuidutils
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
restricted_name_chars = '[a-zA-Z0-9][a-zA-Z0-9_.-]'
|
||||
@ -106,7 +105,7 @@ class Integer(object):
|
||||
try:
|
||||
value = int(value)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to convert value to int'))
|
||||
LOG.exception('Failed to convert value to int')
|
||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||
|
||||
if minimum is not None and value < minimum:
|
||||
@ -142,7 +141,7 @@ class Float(object):
|
||||
try:
|
||||
value = float(value)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to convert value to float'))
|
||||
LOG.exception('Failed to convert value to float')
|
||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||
|
||||
return value
|
||||
@ -160,7 +159,7 @@ class Bool(object):
|
||||
try:
|
||||
value = strutils.bool_from_string(value, strict=True)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to convert value to bool'))
|
||||
LOG.exception('Failed to convert value to bool')
|
||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||
|
||||
return value
|
||||
@ -180,7 +179,7 @@ class Custom(object):
|
||||
try:
|
||||
value = self.user_class(**value)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to validate received value'))
|
||||
LOG.exception('Failed to validate received value')
|
||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||
|
||||
return value
|
||||
@ -202,7 +201,7 @@ class List(object):
|
||||
try:
|
||||
return [self.type.validate(v) for v in value]
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to validate received value'))
|
||||
LOG.exception('Failed to validate received value')
|
||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||
|
||||
|
||||
@ -237,7 +236,7 @@ class Dict(object):
|
||||
return {self.key_type.validate(k): self.value_type.validate(v)
|
||||
for k, v in value.items()}
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to validate received value'))
|
||||
LOG.exception('Failed to validate received value')
|
||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||
|
||||
|
||||
@ -281,7 +280,7 @@ class MemoryType(object):
|
||||
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
||||
if int(value[:-1]) * VALID_UNITS[value[-1]] >= MIN_MEMORY_SIZE:
|
||||
return value
|
||||
LOG.exception(_LE('Failed to validate container memory value'))
|
||||
LOG.exception('Failed to validate container memory value')
|
||||
message = """
|
||||
memory must be either integer or string of below format.
|
||||
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
||||
@ -303,7 +302,7 @@ class ImageSize(object):
|
||||
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
||||
return int(value[:-1]) * VALID_UNITS[value[-1]]
|
||||
else:
|
||||
LOG.exception(_LE('Failed to validate image size'))
|
||||
LOG.exception('Failed to validate image size')
|
||||
message = _("""
|
||||
size must be either integer or string of below format.
|
||||
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
||||
|
@ -26,7 +26,6 @@ from zun.api.controllers.v1.views import containers_view as view
|
||||
from zun.api import utils as api_utils
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common import name_generator
|
||||
from zun.common import policy
|
||||
from zun.common import utils
|
||||
@ -43,8 +42,8 @@ LOG = logging.getLogger(__name__)
|
||||
def _get_container(container_id):
|
||||
container = api_utils.get_resource('Container', container_id)
|
||||
if not container:
|
||||
pecan.abort(404, _LE('Not found; the container you requested '
|
||||
'does not exist.'))
|
||||
pecan.abort(404, ('Not found; the container you requested '
|
||||
'does not exist.'))
|
||||
|
||||
return container
|
||||
|
||||
@ -144,8 +143,8 @@ class ContainersController(rest.RestController):
|
||||
try:
|
||||
containers[i] = compute_api.container_show(context, c)
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Error while list container %(uuid)s: "
|
||||
"%(e)s."),
|
||||
LOG.exception(("Error while list container %(uuid)s: "
|
||||
"%(e)s."),
|
||||
{'uuid': c.uuid, 'e': e})
|
||||
containers[i].status = fields.ContainerStatus.UNKNOWN
|
||||
|
||||
@ -183,10 +182,10 @@ class ContainersController(rest.RestController):
|
||||
count = int(num)
|
||||
if name in ['unless-stopped', 'always']:
|
||||
if count != 0:
|
||||
raise exception.InvalidValue(_LE("maximum retry "
|
||||
"count not valid "
|
||||
"with restart policy "
|
||||
"of %s") % name)
|
||||
raise exception.InvalidValue(("maximum retry "
|
||||
"count not valid "
|
||||
"with restart policy "
|
||||
"of %s") % name)
|
||||
elif name in ['no']:
|
||||
container_dict.get('restart_policy')['MaximumRetryCount'] = '0'
|
||||
|
||||
|
@ -18,7 +18,6 @@ import sys
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import service
|
||||
|
||||
from zun.common.i18n import _LI
|
||||
from zun.common import rpc_service
|
||||
from zun.common import service as zun_service
|
||||
from zun.compute import manager as compute_manager
|
||||
@ -31,7 +30,7 @@ LOG = logging.getLogger(__name__)
|
||||
def main():
|
||||
zun_service.prepare_service(sys.argv)
|
||||
|
||||
LOG.info(_LI('Starting server in PID %s'), os.getpid())
|
||||
LOG.info('Starting server in PID %s', os.getpid())
|
||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||
|
||||
CONF.import_opt('topic', 'zun.conf.compute', group='compute')
|
||||
|
@ -32,7 +32,6 @@ import pecan
|
||||
import six
|
||||
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
import zun.conf
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -118,7 +117,7 @@ def wrap_controller_exception(func, func_server_error, func_client_error):
|
||||
# log the error message with its associated
|
||||
# correlation id
|
||||
log_correlation_id = uuidutils.generate_uuid()
|
||||
LOG.exception(_LE("%(correlation_id)s:%(excp)s") %
|
||||
LOG.exception("%(correlation_id)s:%(excp)s" %
|
||||
{'correlation_id': log_correlation_id,
|
||||
'excp': str(excp)})
|
||||
# raise a client error with an obfuscated message
|
||||
@ -195,8 +194,8 @@ class ZunException(Exception):
|
||||
except KeyError:
|
||||
# kwargs doesn't match a variable in the message
|
||||
# log the issue and the kwargs
|
||||
LOG.exception(_LE('Exception in string format operation, '
|
||||
'kwargs: %s') % kwargs)
|
||||
LOG.exception(('Exception in string format operation, '
|
||||
'kwargs: %s') % kwargs)
|
||||
try:
|
||||
ferr = CONF.fatal_exception_format_errors
|
||||
except cfg.NoSuchOptError:
|
||||
|
@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='zun')
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _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
|
||||
|
@ -18,7 +18,6 @@ from keystoneclient.v3 import client as kc_v3
|
||||
from oslo_log import log as logging
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _LE
|
||||
import zun.conf
|
||||
|
||||
CONF = zun.conf.CONF
|
||||
@ -80,8 +79,8 @@ class KeystoneClientV3(object):
|
||||
auth = ka_v3.Token(auth_url=self.auth_url,
|
||||
token=self.context.auth_token)
|
||||
else:
|
||||
msg = _LE('Keystone API connection failed: no password, '
|
||||
'trust_id or token found.')
|
||||
msg = ('Keystone API connection failed: no password, '
|
||||
'trust_id or token found.')
|
||||
LOG.error(msg)
|
||||
raise exception.AuthorizationFailure(client='keystone',
|
||||
message='reason %s' % msg)
|
||||
|
@ -22,7 +22,6 @@ from oslo_utils import uuidutils
|
||||
from zun.common import clients
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LW
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -95,14 +94,14 @@ class NovaClient(object):
|
||||
try:
|
||||
server = self.client().servers.get(server_id)
|
||||
except exceptions.OverLimit as exc:
|
||||
LOG.warning(_LW("Received an OverLimit response when "
|
||||
"fetching server (%(id)s) : %(exception)s"),
|
||||
LOG.warning(("Received an OverLimit response when "
|
||||
"fetching server (%(id)s) : %(exception)s"),
|
||||
{'id': server_id,
|
||||
'exception': exc})
|
||||
except exceptions.ClientException as exc:
|
||||
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
||||
(500, 503))):
|
||||
LOG.warning(_LW("Received the following exception when "
|
||||
LOG.warning(("Received the following exception when "
|
||||
"fetching server (%(id)s) : %(exception)s"),
|
||||
{'id': server_id,
|
||||
'exception': exc})
|
||||
@ -118,17 +117,17 @@ class NovaClient(object):
|
||||
try:
|
||||
server.get()
|
||||
except exceptions.OverLimit as exc:
|
||||
LOG.warning(_LW("Server %(name)s (%(id)s) received an OverLimit "
|
||||
"response during server.get(): %(exception)s"),
|
||||
LOG.warning(("Server %(name)s (%(id)s) received an OverLimit "
|
||||
"response during server.get(): %(exception)s"),
|
||||
{'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
except exceptions.ClientException as exc:
|
||||
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
||||
(500, 503))):
|
||||
LOG.warning(_LW('Server "%(name)s" (%(id)s) received the '
|
||||
'following exception during server.get(): '
|
||||
'%(exception)s'),
|
||||
LOG.warning(('Server "%(name)s" (%(id)s) received the '
|
||||
'following exception during server.get(): '
|
||||
'%(exception)s'),
|
||||
{'name': server.name,
|
||||
'id': server.id,
|
||||
'exception': exc})
|
||||
@ -236,7 +235,7 @@ class NovaClient(object):
|
||||
server_id = self.get_server_id(server)
|
||||
server = self.client().servers.get(server_id)
|
||||
except exceptions.NotFound as ex:
|
||||
LOG.warning(_LW('Instance (%(server)s) not found: %(ex)s'),
|
||||
LOG.warning('Instance (%(server)s) not found: %(ex)s',
|
||||
{'server': server, 'ex': ex})
|
||||
else:
|
||||
return server.addresses
|
||||
|
@ -28,8 +28,6 @@ import six
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common.i18n import _LW
|
||||
import zun.conf
|
||||
|
||||
CONF = zun.conf.CONF
|
||||
@ -71,7 +69,7 @@ def safe_rstrip(value, chars=None):
|
||||
|
||||
"""
|
||||
if not isinstance(value, six.string_types):
|
||||
LOG.warning(_LW(
|
||||
LOG.warning((
|
||||
"Failed to remove trailing character. Returning original object. "
|
||||
"Supplied object is not a string: %s."
|
||||
), value)
|
||||
@ -147,7 +145,7 @@ def translate_exception(function):
|
||||
return function(self, context, *args, **kwargs)
|
||||
except Exception as e:
|
||||
if not isinstance(e, exception.ZunException):
|
||||
LOG.exception(_LE("Unexpected error: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected error: %s", six.text_type(e))
|
||||
e = exception.ZunException("Unexpected error: %s"
|
||||
% six.text_type(e))
|
||||
raise e
|
||||
@ -196,7 +194,7 @@ def poll_until(retriever, condition=lambda value: value,
|
||||
LOG.error(timeout_msg)
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception occurred: %s"),
|
||||
LOG.exception("Unexpected exception occurred: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
from oslo_log import log as logging
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _LI
|
||||
from zun.common.i18n import _LW
|
||||
from zun import objects
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -35,7 +33,7 @@ class ComputeNodeTracker(object):
|
||||
node = objects.NodeInfo(context)
|
||||
node.hostname = self.host
|
||||
node.create()
|
||||
LOG.info(_LI('Node created for :%(host)s'), {'host': self.host})
|
||||
LOG.info('Node created for :%(host)s', {'host': self.host})
|
||||
self.container_driver.get_available_resources(node)
|
||||
# NOTE(sbiswas7): Consider removing the return statement if not needed
|
||||
return node
|
||||
@ -45,5 +43,5 @@ class ComputeNodeTracker(object):
|
||||
try:
|
||||
return objects.NodeInfo.get_by_hostname(context, self.host)
|
||||
except exception.NotFound:
|
||||
LOG.warning(_LW("No compute node record for: %(host)s"),
|
||||
LOG.warning("No compute node record for: %(host)s",
|
||||
{'host': self.host})
|
||||
|
@ -18,7 +18,6 @@ from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common import utils
|
||||
from zun.common.utils import translate_exception
|
||||
import zun.conf
|
||||
@ -59,7 +58,7 @@ class Manager(object):
|
||||
try:
|
||||
self.driver.delete_sandbox(context, sandbox_id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Error occurred while deleting sandbox: %s"),
|
||||
LOG.error("Error occurred while deleting sandbox: %s",
|
||||
six.text_type(e))
|
||||
|
||||
def _do_container_create(self, context, container, reraise=False):
|
||||
@ -82,7 +81,7 @@ class Manager(object):
|
||||
image=sandbox_image)
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
return
|
||||
@ -107,15 +106,14 @@ class Manager(object):
|
||||
return
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker image API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker image API: %s",
|
||||
six.text_type(e))
|
||||
self._do_sandbox_cleanup(context, sandbox_id)
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
return
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._do_sandbox_cleanup(context, sandbox_id)
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
@ -134,15 +132,14 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker create API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker create API: %s",
|
||||
six.text_type(e))
|
||||
self._do_sandbox_cleanup(context, sandbox_id)
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
return
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._do_sandbox_cleanup(context, sandbox_id)
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
@ -159,13 +156,12 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker start API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker start API: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
|
||||
@ -177,12 +173,12 @@ class Manager(object):
|
||||
try:
|
||||
self.driver.delete(container, force)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker "
|
||||
"delete API: %s"), six.text_type(e))
|
||||
LOG.error(("Error occurred while calling Docker "
|
||||
"delete API: %s"), six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -193,7 +189,7 @@ class Manager(object):
|
||||
try:
|
||||
self.driver.delete_sandbox(context, sandbox_id)
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
raise
|
||||
@ -208,11 +204,11 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.list()
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker list API: %s"),
|
||||
LOG.error("Error occurred while calling Docker list API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
@translate_exception
|
||||
@ -223,11 +219,11 @@ class Manager(object):
|
||||
container.save(context)
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker show API: %s"),
|
||||
LOG.error("Error occurred while calling Docker show API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
def _do_container_reboot(self, context, container, timeout, reraise=False):
|
||||
@ -241,12 +237,12 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE("Error occurred while calling Docker reboot "
|
||||
"API: %s"), six.text_type(e))
|
||||
LOG.error(("Error occurred while calling Docker reboot "
|
||||
"API: %s"), six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
|
||||
@ -264,13 +260,12 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker stop API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker stop API: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
self._fail_container(context, container, six.text_type(e))
|
||||
|
||||
@ -288,12 +283,11 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker pause API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker pause API: %s",
|
||||
six.text_type(e))
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s,"),
|
||||
LOG.exception("Unexpected exception: %s,",
|
||||
six.text_type(e))
|
||||
|
||||
def container_pause(self, context, container):
|
||||
@ -307,12 +301,12 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker unpause API: %s"),
|
||||
LOG.error(
|
||||
"Error occurred while calling Docker unpause API: %s",
|
||||
six.text_type(e))
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
|
||||
def container_unpause(self, context, container):
|
||||
@ -328,11 +322,11 @@ class Manager(object):
|
||||
timestamps=timestamps, tail=tail,
|
||||
since=since)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker logs API: %s"),
|
||||
LOG.error("Error occurred while calling Docker logs API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
@translate_exception
|
||||
@ -342,11 +336,11 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.execute(container, command)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker exec API: %s"),
|
||||
LOG.error("Error occurred while calling Docker exec API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
def _do_container_kill(self, context, container, signal, reraise=False):
|
||||
@ -357,9 +351,8 @@ class Manager(object):
|
||||
return container
|
||||
except exception.DockerError as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker kill API: %s"),
|
||||
six.text_type(e))
|
||||
LOG.error("Error occurred while calling Docker kill API: %s",
|
||||
six.text_type(e))
|
||||
|
||||
def container_kill(self, context, container, signal):
|
||||
utils.spawn_n(self._do_container_kill, context, container, signal)
|
||||
@ -375,7 +368,7 @@ class Manager(object):
|
||||
try:
|
||||
self.driver.update(container)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling docker API: %s"),
|
||||
LOG.error("Error occurred while calling docker API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -388,8 +381,8 @@ class Manager(object):
|
||||
try:
|
||||
url = self.driver.get_websocket_url(container)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Error occurred while calling "
|
||||
"get websocket url function: %s"),
|
||||
LOG.error(("Error occurred while calling "
|
||||
"get websocket url function: %s"),
|
||||
six.text_type(e))
|
||||
raise
|
||||
return url
|
||||
@ -400,8 +393,8 @@ class Manager(object):
|
||||
try:
|
||||
container = self.driver.resize(container, height, width)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling docker "
|
||||
"resize API: %s"),
|
||||
LOG.error(("Error occurred while calling docker "
|
||||
"resize API: %s"),
|
||||
six.text_type(e))
|
||||
raise
|
||||
return container
|
||||
@ -413,11 +406,11 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.top(container, ps_args)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker top API: %s"),
|
||||
LOG.error("Error occurred while calling Docker top API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
@translate_exception
|
||||
@ -426,12 +419,12 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.get_archive(container, path)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker get_archive API: %s"),
|
||||
LOG.error(
|
||||
"Error occurred while calling Docker get_archive API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
@translate_exception
|
||||
@ -440,12 +433,12 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.put_archive(container, path, data)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE(
|
||||
"Error occurred while calling Docker put_archive API: %s"),
|
||||
LOG.error(
|
||||
"Error occurred while calling Docker put_archive API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||
raise
|
||||
|
||||
def image_pull(self, context, image):
|
||||
@ -467,11 +460,11 @@ class Manager(object):
|
||||
LOG.error(six.text_type(e))
|
||||
return
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker image API: %s"),
|
||||
LOG.error("Error occurred while calling Docker image API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -482,8 +475,8 @@ class Manager(object):
|
||||
return image_driver.search_image(context, image,
|
||||
image_driver_name, exact_match)
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception while searching "
|
||||
"image: %s"), six.text_type(e))
|
||||
LOG.exception("Unexpected exception while searching image: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
def _get_container_addresses(self, context, container):
|
||||
@ -491,10 +484,10 @@ class Manager(object):
|
||||
try:
|
||||
return self.driver.get_addresses(context, container)
|
||||
except exception.DockerError as e:
|
||||
LOG.error(_LE("Error occurred while calling Docker API: %s"),
|
||||
LOG.error("Error occurred while calling Docker API: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
@ -20,9 +20,6 @@ from oslo_utils import timeutils
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common.i18n import _LI
|
||||
from zun.common.i18n import _LW
|
||||
from zun.common import nova
|
||||
from zun.common import utils
|
||||
from zun.common.utils import check_container_id
|
||||
@ -141,7 +138,7 @@ class DockerDriver(driver.ContainerDriver):
|
||||
st = datetime.datetime.strptime((status_time[:19]),
|
||||
'%Y-%m-%dT%H:%M:%S')
|
||||
except ValueError as e:
|
||||
LOG.exception(_LE("Error on parse {} : {}").format(status_time, e))
|
||||
LOG.exception("Error on parse {} : {}".format(status_time, e))
|
||||
return
|
||||
|
||||
if st == datetime.datetime(1, 1, 1):
|
||||
@ -414,7 +411,7 @@ class DockerDriver(driver.ContainerDriver):
|
||||
if container.meta:
|
||||
return container.meta.get('sandbox_id', None)
|
||||
else:
|
||||
LOG.warning(_LW("Unexpected missing of sandbox_id"))
|
||||
LOG.warning("Unexpected missing of sandbox_id")
|
||||
return None
|
||||
|
||||
def set_sandbox_id(self, container, sandbox_id):
|
||||
@ -475,9 +472,9 @@ class NovaDockerDriver(DockerDriver):
|
||||
def _check_active():
|
||||
return novaclient.check_active(server)
|
||||
|
||||
success_msg = _LI("Created server %s successfully.") % server.id
|
||||
timeout_msg = _LE("Failed to create server %s. Timeout waiting for "
|
||||
"server to become active.") % server.id
|
||||
success_msg = "Created server %s successfully." % server.id
|
||||
timeout_msg = ("Failed to create server %s. Timeout waiting for "
|
||||
"server to become active.") % server.id
|
||||
utils.poll_until(_check_active,
|
||||
sleep_time=CONF.default_sleep_time,
|
||||
time_out=timeout or CONF.default_timeout,
|
||||
@ -488,7 +485,7 @@ class NovaDockerDriver(DockerDriver):
|
||||
novaclient = nova.NovaClient(elevated)
|
||||
server_name = self._find_server_by_container_id(sandbox_id)
|
||||
if not server_name:
|
||||
LOG.warning(_LW("Cannot find server name for sandbox %s") %
|
||||
LOG.warning("Cannot find server name for sandbox %s" %
|
||||
sandbox_id)
|
||||
return
|
||||
|
||||
@ -500,7 +497,7 @@ class NovaDockerDriver(DockerDriver):
|
||||
novaclient = nova.NovaClient(elevated)
|
||||
server_name = self._find_server_by_container_id(sandbox_id)
|
||||
if not server_name:
|
||||
LOG.warning(_LW("Cannot find server name for sandbox %s") %
|
||||
LOG.warning("Cannot find server name for sandbox %s" %
|
||||
sandbox_id)
|
||||
return
|
||||
novaclient.stop_server(server_name)
|
||||
@ -510,9 +507,9 @@ class NovaDockerDriver(DockerDriver):
|
||||
def _check_delete_complete():
|
||||
return novaclient.check_delete_server_complete(server_id)
|
||||
|
||||
success_msg = _LI("Delete server %s successfully.") % server_id
|
||||
timeout_msg = _LE("Failed to create server %s. Timeout waiting for "
|
||||
"server to be deleted.") % server_id
|
||||
success_msg = "Delete server %s successfully." % server_id
|
||||
timeout_msg = ("Failed to create server %s. Timeout waiting for "
|
||||
"server to be deleted.") % server_id
|
||||
utils.poll_until(_check_delete_complete,
|
||||
sleep_time=CONF.default_sleep_time,
|
||||
time_out=timeout or CONF.default_timeout,
|
||||
|
@ -17,8 +17,6 @@ from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common.i18n import _LI
|
||||
import zun.conf
|
||||
from zun.container.os_capability.linux import os_capability_linux
|
||||
from zun import objects
|
||||
@ -39,11 +37,11 @@ def load_container_driver(container_driver=None):
|
||||
if not container_driver:
|
||||
container_driver = CONF.container_driver
|
||||
if not container_driver:
|
||||
LOG.error(_LE("Container driver option required, "
|
||||
"but not specified"))
|
||||
LOG.error(("Container driver option required, "
|
||||
"but not specified"))
|
||||
sys.exit(1)
|
||||
|
||||
LOG.info(_LI("Loading container driver '%s'"), container_driver)
|
||||
LOG.info("Loading container driver '%s'", container_driver)
|
||||
try:
|
||||
if not container_driver.startswith('zun.'):
|
||||
container_driver = 'zun.container.%s' % container_driver
|
||||
@ -54,7 +52,7 @@ def load_container_driver(container_driver=None):
|
||||
|
||||
return driver
|
||||
except ImportError:
|
||||
LOG.exception(_LE("Unable to load the container driver"))
|
||||
LOG.exception("Unable to load the container driver")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@ import six
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _LE
|
||||
from zun.container.os_capability import host_capability
|
||||
|
||||
|
||||
@ -35,16 +34,16 @@ class LinuxHost(host_capability.Host):
|
||||
try:
|
||||
output = processutils.execute('lscpu', '-p=socket,cpu,online')
|
||||
except processutils.ProcessExecutionError as e:
|
||||
LOG.exception(_LE("There was a problem while executing lscpu "
|
||||
"-p=socket,cpu,online : %s"), six.text_type(e))
|
||||
LOG.exception(("There was a problem while executing lscpu "
|
||||
"-p=socket,cpu,online : %s"), six.text_type(e))
|
||||
# There is a possibility that an older version of lscpu is used
|
||||
# So let's try without the online column
|
||||
try:
|
||||
output = processutils.execute('lscpu', '-p=socket,cpu')
|
||||
old_lscpu = True
|
||||
except processutils.ProcessExecutionError as e:
|
||||
LOG.exception(_LE("There was a problem while executing lscpu "
|
||||
"-p=socket,cpu : %s"), six.text_type(e))
|
||||
LOG.exception(("There was a problem while executing lscpu "
|
||||
"-p=socket,cpu : %s"), six.text_type(e))
|
||||
raise exception.CommandError(cmd="lscpu")
|
||||
if old_lscpu:
|
||||
cpu_sock_pair = re.findall("\d+(?:,\d+)?", str(output))
|
||||
|
@ -26,7 +26,6 @@ import six
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common import singleton
|
||||
import zun.conf
|
||||
from zun.db.etcd import models
|
||||
@ -83,7 +82,7 @@ def translate_etcd_result(etcd_result, model_type):
|
||||
_('The model_type value: %s is invalid.'), model_type)
|
||||
return ret
|
||||
except (ValueError, TypeError) as e:
|
||||
LOG.error(_LE("Error occurred while translating etcd result: %s"),
|
||||
LOG.error("Error occurred while translating etcd result: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -102,7 +101,7 @@ class EtcdAPI(object):
|
||||
if d.key in ('/containers',):
|
||||
self.client.delete(d.key, recursive=True)
|
||||
except etcd.EtcdKeyNotFound as e:
|
||||
LOG.error(_LE('Error occurred while cleaning zun data: %s'),
|
||||
LOG.error('Error occurred while cleaning zun data: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -152,7 +151,7 @@ class EtcdAPI(object):
|
||||
return []
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE("Error occurred while reading from etcd server: %s"),
|
||||
"Error occurred while reading from etcd server: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -183,7 +182,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
return
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
||||
LOG.error('Error occurred while retrieving container: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
if len(containers) > 0:
|
||||
@ -221,7 +220,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ContainerNotFound(container=container_uuid)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
||||
LOG.error('Error occurred while retrieving container: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -233,7 +232,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ContainerNotFound(container=container_name)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
||||
LOG.error('Error occurred while retrieving container: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -273,7 +272,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ContainerNotFound(container=container_uuid)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while updating container: %s'),
|
||||
LOG.error('Error occurred while updating container: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -292,12 +291,12 @@ class EtcdAPI(object):
|
||||
res = getattr(self.client.read('/zun_services'), 'children', None)
|
||||
except etcd.EtcdKeyNotFound:
|
||||
LOG.error(
|
||||
_LE("Path '/zun_services' does not exist, seems etcd server "
|
||||
"was not been initialized appropriately for Zun."))
|
||||
("Path '/zun_services' does not exist, seems etcd server "
|
||||
"was not been initialized appropriately for Zun."))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE("Error occurred while reading from etcd server: %s"),
|
||||
"Error occurred while reading from etcd server: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -322,7 +321,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while retrieving zun service: %s'),
|
||||
LOG.error('Error occurred while retrieving zun service: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
finally:
|
||||
@ -335,7 +334,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while destroying zun service: %s'),
|
||||
LOG.error('Error occurred while destroying zun service: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -351,7 +350,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while updating service: %s'),
|
||||
LOG.error('Error occurred while updating service: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -385,7 +384,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ImageNotFound(image=image_uuid)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while updating image: %s'),
|
||||
LOG.error('Error occurred while updating image: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -401,7 +400,7 @@ class EtcdAPI(object):
|
||||
return []
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE("Error occurred while reading from etcd server: %s"),
|
||||
"Error occurred while reading from etcd server: %s",
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -428,7 +427,7 @@ class EtcdAPI(object):
|
||||
except etcd.EtcdKeyNotFound:
|
||||
raise exception.ImageNotFound(image=image_uuid)
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Error occurred while retrieving image: %s'),
|
||||
LOG.error('Error occurred while retrieving image: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -448,7 +447,7 @@ class EtcdAPI(object):
|
||||
return []
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE('Error occurred while reading from etcd server: %s'),
|
||||
'Error occurred while reading from etcd server: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -486,7 +485,7 @@ class EtcdAPI(object):
|
||||
raise exception.ResourceClassNotFound(resource_class=uuid)
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE('Error occurred while retriving resource class: %s'),
|
||||
'Error occurred while retriving resource class: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
return resource_class
|
||||
@ -499,7 +498,7 @@ class EtcdAPI(object):
|
||||
raise exception.ResourceClassNotFound(resource_class=name)
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE('Error occurred while retriving resource class: %s'),
|
||||
'Error occurred while retriving resource class: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
|
||||
@ -531,7 +530,7 @@ class EtcdAPI(object):
|
||||
raise exception.ResourceClassNotFound(resource_class=uuid)
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE('Error occurred while updating resource class: %s'),
|
||||
'Error occurred while updating resource class: %s',
|
||||
six.text_type(e))
|
||||
raise
|
||||
return translate_etcd_result(target, 'resource_class')
|
||||
|
@ -20,8 +20,6 @@ import stevedore
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _
|
||||
from zun.common.i18n import _LE
|
||||
from zun.common.i18n import _LI
|
||||
from zun.common.utils import parse_image_name
|
||||
import zun.conf
|
||||
|
||||
@ -39,11 +37,11 @@ def load_image_driver(image_driver=None):
|
||||
:returns: a ContainerImageDriver instance
|
||||
"""
|
||||
if not image_driver:
|
||||
LOG.error(_LE("Container image driver option required, "
|
||||
"but not specified"))
|
||||
LOG.error(("Container image driver option required, "
|
||||
"but not specified"))
|
||||
sys.exit(1)
|
||||
|
||||
LOG.info(_LI("Loading container image driver '%s'"), image_driver)
|
||||
LOG.info("Loading container image driver '%s'", image_driver)
|
||||
try:
|
||||
driver = stevedore.driver.DriverManager(
|
||||
"zun.image.driver",
|
||||
@ -56,7 +54,7 @@ def load_image_driver(image_driver=None):
|
||||
|
||||
return driver
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to load the container image driver"))
|
||||
LOG.exception("Unable to load the container image driver")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -77,8 +75,8 @@ def pull_image(context, repo, tag, image_pull_policy, image_driver):
|
||||
except exception.ImageNotFound:
|
||||
image = None
|
||||
except Exception as e:
|
||||
LOG.exception(_LE('Unknown exception occurred while loading '
|
||||
'image: %s'), six.text_type(e))
|
||||
LOG.exception(('Unknown exception occurred while loading '
|
||||
'image: %s'), six.text_type(e))
|
||||
raise exception.ZunException(six.text_type(e))
|
||||
if not image:
|
||||
raise exception.ImageNotFound("Image %s not found" % repo)
|
||||
@ -99,8 +97,8 @@ def search_image(context, image_name, image_driver, exact_match):
|
||||
exact_match=exact_match)
|
||||
images.extend(imgs)
|
||||
except Exception as e:
|
||||
LOG.exception(_LE('Unknown exception occurred while searching '
|
||||
'for image: %s'), six.text_type(e))
|
||||
LOG.exception(('Unknown exception occurred while searching '
|
||||
'for image: %s'), six.text_type(e))
|
||||
raise exception.ZunException(six.text_type(e))
|
||||
return images
|
||||
|
||||
|
@ -17,7 +17,6 @@ from oslo_utils import uuidutils
|
||||
|
||||
from zun.common import clients
|
||||
from zun.common import exception
|
||||
from zun.common.i18n import _LE
|
||||
|
||||
|
||||
def create_glanceclient(context):
|
||||
@ -35,9 +34,9 @@ def find_image(context, image_ident):
|
||||
if len(matches) == 0:
|
||||
raise exception.ImageNotFound(image=image_ident)
|
||||
if len(matches) > 1:
|
||||
msg = _LE("Multiple images exist with same name "
|
||||
"%(image_ident)s. Please use the image id "
|
||||
"instead.") % {'image_ident': image_ident}
|
||||
msg = ("Multiple images exist with same name "
|
||||
"%(image_ident)s. Please use the image id "
|
||||
"instead.") % {'image_ident': image_ident}
|
||||
raise exception.Conflict(msg)
|
||||
return matches[0]
|
||||
|
||||
|
@ -16,7 +16,6 @@ Filter support
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from zun.common.i18n import _LI
|
||||
from zun.scheduler import loadables
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -87,7 +86,7 @@ class BaseFilterHandler(loadables.BaseLoader):
|
||||
for obj in list_objs]
|
||||
full_filter_results.append((cls_name, remaining))
|
||||
else:
|
||||
LOG.info(_LI("Filter %s returned 0 hosts"), cls_name)
|
||||
LOG.info("Filter %s returned 0 hosts", cls_name)
|
||||
full_filter_results.append((cls_name, None))
|
||||
break
|
||||
LOG.debug("Filter %(cls_name)s returned "
|
||||
@ -102,10 +101,10 @@ class BaseFilterHandler(loadables.BaseLoader):
|
||||
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
||||
) % msg_dict
|
||||
msg_dict["str_results"] = str(part_filter_results)
|
||||
part_msg = _LI("Filtering removed all hosts for the request with "
|
||||
"container ID "
|
||||
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
||||
) % msg_dict
|
||||
part_msg = ("Filtering removed all hosts for the request with "
|
||||
"container ID "
|
||||
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
||||
) % msg_dict
|
||||
LOG.debug(full_msg)
|
||||
LOG.info(part_msg)
|
||||
return list_objs
|
||||
|
@ -18,7 +18,6 @@ from oslo_log import log
|
||||
from oslo_service import periodic_task
|
||||
|
||||
from zun.common import context
|
||||
from zun.common.i18n import _LE
|
||||
from zun.container import driver
|
||||
from zun import objects
|
||||
from zun.objects import fields
|
||||
@ -90,7 +89,7 @@ class ContainerStatusSyncPeriodicJob(periodic_task.PeriodicTasks):
|
||||
LOG.info(msg % (updated_container.uuid, old_status,
|
||||
updated_container.status))
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
|
||||
for container_id in deleted_containers:
|
||||
@ -108,7 +107,7 @@ class ContainerStatusSyncPeriodicJob(periodic_task.PeriodicTasks):
|
||||
LOG.info(msg % (updated_container.uuid, old_status,
|
||||
updated_container.status))
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("Unexpected exception: %s"),
|
||||
LOG.exception("Unexpected exception: %s",
|
||||
six.text_type(e))
|
||||
|
||||
LOG.debug('Update container status end')
|
||||
|
Loading…
Reference in New Issue
Block a user