From b9435c4efeef9f31dab2f1012e7a7364f7054197 Mon Sep 17 00:00:00 2001 From: Hua Wang Date: Mon, 28 Dec 2015 11:35:50 +0800 Subject: [PATCH] Don't add exception in msg when using LOG.exception LOG.exception can record the exception automatically, so we should add exception in msg. Change-Id: I60694fd8d1b1c0bd62461900c6746a0cc300cf5b Closes-Bug: #1529534 --- magnum/common/keystone.py | 8 ++++---- magnum/conductor/handlers/docker_conductor.py | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/magnum/common/keystone.py b/magnum/common/keystone.py index 8bfedb136c..48bbf3ce94 100644 --- a/magnum/common/keystone.py +++ b/magnum/common/keystone.py @@ -120,8 +120,8 @@ class KeystoneClientV3(object): trustee_user=trustee_user, impersonation=impersonation, role_names=role_names) - except Exception as e: - LOG.exception(str(e)) + except Exception: + LOG.exception(_LE('Failed to create trust')) raise exception.TrustCreateFailed( trustee_user_id=trustee_user) return trust @@ -137,6 +137,6 @@ class KeystoneClientV3(object): self.client.trusts.delete(trust_id) except kc_exception.NotFound: pass - except Exception as e: - LOG.exception(str(e)) + except Exception: + LOG.exception(_LE('Failed to delete trust')) raise exception.TrustDeleteFailed(trust_id=trust_id) diff --git a/magnum/conductor/handlers/docker_conductor.py b/magnum/conductor/handlers/docker_conductor.py index 790e333b8b..41ab910993 100644 --- a/magnum/conductor/handlers/docker_conductor.py +++ b/magnum/conductor/handlers/docker_conductor.py @@ -37,9 +37,7 @@ def wrap_container_exception(f): container_uuid = kwargs.get('container').uuid LOG.exception(_LE("Error while connect to docker " - "container %(name)s: %(error)s"), - {'name': container_uuid, - 'error': str(e)}) + "container %s"), container_uuid) raise exception.ContainerException( "Docker internal Error: %s" % str(e)) return functools.wraps(f)(wrapped)