Increase exception log details
Add informative message to log, as the exception is logged by default
Replaces:
except Exception as exc:
LOG.exception(exc)
With:
except Exception:
LOG.exception("[Description of the failed operation]")
Closes-bug: #1262547
Change-Id: I97cd13e4b32df9a3f9b2e7e1f8946a6a4e0aed3f
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 2f7a650..2ce5cce 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -245,20 +245,20 @@
@classmethod
def tearDownClass(cls):
"""Calls the callables added by addResourceCleanUp,
- when you overwire this function dont't forget to call this too.
+ when you overwrite this function don't forget to call this too.
"""
fail_count = 0
trash_keys = sorted(cls._resource_trash_bin, reverse=True)
for key in trash_keys:
(function, pos_args, kw_args) = cls._resource_trash_bin[key]
try:
- LOG.debug("Cleaning up: %s" %
- friendly_function_call_str(function, *pos_args,
- **kw_args))
+ func_name = friendly_function_call_str(function, *pos_args,
+ **kw_args)
+ LOG.debug("Cleaning up: %s" % func_name)
function(*pos_args, **kw_args)
- except BaseException as exc:
+ except BaseException:
fail_count += 1
- LOG.exception(exc)
+ LOG.exception("Cleanup failed %s" % func_name)
finally:
del cls._resource_trash_bin[key]
super(BotoTestCase, cls).tearDownClass()
@@ -428,12 +428,12 @@
try:
bucket.delete_key(obj.key)
obj.close()
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to delete key %s " % obj.key)
exc_num += 1
conn.delete_bucket(bucket)
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to destroy bucket %s " % bucket)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)
@@ -463,8 +463,8 @@
try:
instance.terminate()
re_search_wait(_instance_state, "_GONE")
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to terminate instance %s " % instance)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)
@@ -497,8 +497,8 @@
try:
if volume.status != "available":
volume.detach(force=True)
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to detach volume %s" % volume)
# exc_num += 1 "nonlocal" not in python2
return volume.status
@@ -506,8 +506,8 @@
re_search_wait(_volume_state, "available") # not validates status
LOG.info(_volume_state())
volume.delete()
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to delete volume %s" % volume)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)