1
0
mirror of https://github.com/vmware/vsphere-automation-sdk-python.git synced 2024-11-24 10:19:59 -05:00

Remove try/catch block from sample_base.py

There is an bug in the catch block where the exception didn't get
re-raised when cleanup is false. When something goes wrong, it's better
to leave the setup as is for dubugging. Thus removing the try/catch.

Signed-off-by: Tianhao He <het@vmware.com>
This commit is contained in:
Tianhao He 2019-02-26 17:39:24 +08:00
parent 9a53c77b55
commit e7af04409a

View File

@ -75,14 +75,7 @@ class SampleBase(object):
for name in dir(self):
attr = getattr(self, name)
if callable(attr) and name == '_execute':
try:
attr() # calling the method
except Exception as e:
# print the exception and move on to the cleanup stage if cleardata is set to True.
traceback.print_exc()
if bool(self.cleardata) is not True:
# re-throw the exception
raise Exception(e)
def after(self):
if bool(self.cleardata) is True: