diff --git a/zun/api/controllers/v1/containers.py b/zun/api/controllers/v1/containers.py index a03d4f312..a3660e564 100644 --- a/zun/api/controllers/v1/containers.py +++ b/zun/api/controllers/v1/containers.py @@ -154,8 +154,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 diff --git a/zun/common/nova.py b/zun/common/nova.py index 7bd5bc867..51438e1f2 100644 --- a/zun/common/nova.py +++ b/zun/common/nova.py @@ -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}) diff --git a/zun/common/utils.py b/zun/common/utils.py index d9ee42613..4b8f59347 100644 --- a/zun/common/utils.py +++ b/zun/common/utils.py @@ -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 diff --git a/zun/compute/manager.py b/zun/compute/manager.py index 31a089da5..fe446da46 100644 --- a/zun/compute/manager.py +++ b/zun/compute/manager.py @@ -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 diff --git a/zun/container/driver.py b/zun/container/driver.py index 8ce560745..9d77fbb8c 100644 --- a/zun/container/driver.py +++ b/zun/container/driver.py @@ -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) diff --git a/zun/container/os_capability/linux/os_capability_linux.py b/zun/container/os_capability/linux/os_capability_linux.py index 0526b6feb..57ff05030 100644 --- a/zun/container/os_capability/linux/os_capability_linux.py +++ b/zun/container/os_capability/linux/os_capability_linux.py @@ -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)) diff --git a/zun/image/driver.py b/zun/image/driver.py index 308cabcbf..7af7b7e6c 100644 --- a/zun/image/driver.py +++ b/zun/image/driver.py @@ -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 diff --git a/zun/tests/migration/test_migrations.py b/zun/tests/migration/test_migrations.py index 672479724..f7e56d80d 100644 --- a/zun/tests/migration/test_migrations.py +++ b/zun/tests/migration/test_migrations.py @@ -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