From 1b7f413b6069ec0e1b6d7ca973f89968f19058eb Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Thu, 4 Feb 2016 15:19:07 +0000 Subject: [PATCH] Pass tempest return code back to caller Use case: I'm running refstack-client in a tox job, which always appears to succeed, even when the test fails. Currently, unless it throws a backtrace on it's own, the refstack-client script always returns successfully, even when the tempest job it's running fails. This change simply passes non-zero return codes back through as the refstack-client's return code. Only the test() method was affected here, because it's the only externally callable function that uses subprocess. Other functions can now return non-zero return codes as well. Change-Id: I0ce786babcbee47da1c038a3478bcd4de0dff16e --- refstack-client | 2 +- refstack_client/refstack_client.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/refstack-client b/refstack-client index 39bbd25..7e5250c 100755 --- a/refstack-client +++ b/refstack-client @@ -28,4 +28,4 @@ from refstack_client import refstack_client if __name__ == '__main__': args = refstack_client.parse_cli_args() test = refstack_client.RefstackClient(args) - getattr(test, args.func)() + raise SystemExit(getattr(test, args.func)()) diff --git a/refstack_client/refstack_client.py b/refstack_client/refstack_client.py index d1d3717..bead06c 100755 --- a/refstack_client/refstack_client.py +++ b/refstack_client/refstack_client.py @@ -459,6 +459,7 @@ class RefstackClient: else: self.logger.error("Problem executing Tempest script. Exit code %d", process.returncode) + return process.returncode def upload(self): '''Perform upload to RefStack URL.'''