From e88b7f77c80a4c2cead907230e15814460fc0ca8 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Fri, 4 Aug 2017 00:52:00 -0700 Subject: [PATCH] Fix return error code when something goes wrong Change-Id: I6a401ddcf33cf4a337d849616a082232175c0a46 --- vmtp/vmtp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vmtp/vmtp.py b/vmtp/vmtp.py index 54c49b2..4f881e4 100755 --- a/vmtp/vmtp.py +++ b/vmtp/vmtp.py @@ -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):