Merge "Remove extra bracket in LOG message"

This commit is contained in:
Jenkins 2017-08-28 09:30:15 +00:00 committed by Gerrit Code Review
commit 6a6199500e
8 changed files with 33 additions and 34 deletions

View File

@ -156,8 +156,8 @@ class ContainersController(base.Controller):
try:
containers[i] = compute_api.container_show(context, c)
except Exception as e:
LOG.exception(("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 = consts.UNKNOWN

View File

@ -94,15 +94,15 @@ class NovaClient(object):
try:
server = self.client().servers.get(server_id)
except exceptions.OverLimit as exc:
LOG.warning(("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(("Received the following exception when "
"fetching server (%(id)s) : %(exception)s"),
LOG.warning("Received the following exception when "
"fetching server (%(id)s) : %(exception)s",
{'id': server_id,
'exception': exc})
else:
@ -117,17 +117,17 @@ class NovaClient(object):
try:
server.get()
except exceptions.OverLimit as exc:
LOG.warning(("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(('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})

View File

@ -86,10 +86,9 @@ def safe_rstrip(value, chars=None):
"""
if not isinstance(value, six.string_types):
LOG.warning((
LOG.warning(
"Failed to remove trailing character. Returning original object. "
"Supplied object is not a string: %s."
), value)
"Supplied object is not a string: %s.", value)
return value
return value.rstrip(chars) or value

View File

@ -244,8 +244,8 @@ class Manager(periodic_task.PeriodicTasks):
self.driver.delete(context, container, force)
except exception.DockerError as e:
with excutils.save_and_reraise_exception(reraise=reraise):
LOG.error(("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))
except Exception as e:
with excutils.save_and_reraise_exception(reraise=reraise):
@ -328,8 +328,8 @@ class Manager(periodic_task.PeriodicTasks):
return container
except exception.DockerError as e:
with excutils.save_and_reraise_exception(reraise=reraise):
LOG.error(("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):
@ -499,8 +499,8 @@ class Manager(periodic_task.PeriodicTasks):
container.save(context)
return access_url
except Exception as e:
LOG.error(("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
@ -511,8 +511,8 @@ class Manager(periodic_task.PeriodicTasks):
container = self.driver.resize(context, container, height, width)
return container
except exception.DockerError as e:
LOG.error(("Error occurred while calling docker "
"resize API: %s"),
LOG.error("Error occurred while calling docker "
"resize API: %s",
six.text_type(e))
raise

View File

@ -38,8 +38,8 @@ def load_container_driver(container_driver=None):
if not container_driver:
container_driver = CONF.container_driver
if not container_driver:
LOG.error(("Container driver option required, "
"but not specified"))
LOG.error("Container driver option required, "
"but not specified")
sys.exit(1)
LOG.info("Loading container driver '%s'", container_driver)

View File

@ -42,8 +42,8 @@ class LinuxHost(host_capability.Host):
output = processutils.execute('lscpu', '-p=socket,cpu')
old_lscpu = True
except processutils.ProcessExecutionError as e:
LOG.exception(("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))

View File

@ -37,8 +37,8 @@ def load_image_driver(image_driver=None):
:returns: a ContainerImageDriver instance
"""
if not image_driver:
LOG.error(("Container image driver option required, "
"but not specified"))
LOG.error("Container image driver option required, "
"but not specified")
sys.exit(1)
LOG.info("Loading container image driver '%s'", image_driver)
@ -76,8 +76,8 @@ def pull_image(context, repo, tag, image_pull_policy='always',
except exception.ImageNotFound:
image = None
except Exception as e:
LOG.exception(('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)
@ -98,8 +98,8 @@ def search_image(context, image_name, image_driver, exact_match):
exact_match)
images.extend(imgs)
except Exception as e:
LOG.exception(('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

View File

@ -144,8 +144,8 @@ class WalkVersionsMixin(object):
if check:
check(engine, data)
except Exception:
LOG.error(("Failed to migrate to version %(version)s on engine "
"%(engine)s"),
LOG.error("Failed to migrate to version %(version)s on engine "
"%(engine)s",
{'version': version, 'engine': engine})
raise