Fix return error code when something goes wrong

Change-Id: I6a401ddcf33cf4a337d849616a082232175c0a46
This commit is contained in:
Yichen Wang 2017-08-04 00:52:00 -07:00
parent a9eb373e9f
commit e88b7f77c8

View File

@ -467,15 +467,15 @@ class VmtpTest(object):
except KeyboardInterrupt:
traceback.format_exc()
except (VmtpException, sshutils.SSHError, ClientException, Exception):
global return_code
LOG.error(traceback.format_exc())
error_flag = True
return_code = 1
if self.config.stop_on_error and error_flag:
LOG.error('Stopping execution on error, cleanup all VMs/networks manually')
sys.exit(2)
else:
global return_code
return_code = 1
self.teardown()
def test_native_tp(nhosts, ifname, config):