From: Thanh Ha Date: Fri, 9 Jun 2017 21:35:58 +0000 (-0400) Subject: Ensure shell scripts exit with proper status codes X-Git-Tag: v0.3.0~4 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F5136%2F1;p=releng%2Flftools.git Ensure shell scripts exit with proper status codes Otherwise shell scripts called by lftools will return success which may be incorrect. Change-Id: I607dd7d5047da51446b953e27a9d48c31c16736c Signed-off-by: Thanh Ha --- diff --git a/lftools/cli/deploy.py b/lftools/cli/deploy.py index cde4fbb3..318b14f0 100644 --- a/lftools/cli/deploy.py +++ b/lftools/cli/deploy.py @@ -13,6 +13,7 @@ __author__ = 'Thanh Ha' import subprocess +import sys import click @@ -43,7 +44,8 @@ def archives(ctx, nexus_url, nexus_path, workspace, pattern): with the name "logs" as this is a hardcoded path. Also this script uses ~/.netrc for it's authentication which must be provided. """ - subprocess.call(['deploy', 'archives', nexus_url, nexus_path, workspace, pattern]) + status = subprocess.call(['deploy', 'archives', nexus_url, nexus_path, workspace, pattern]) + sys.exit(status) @click.command() @@ -61,7 +63,8 @@ def logs(ctx, nexus_url, nexus_path, build_url): with the name "logs" as this is a hardcoded path. Also this script uses ~/.netrc for it's authentication which must be provided. """ - subprocess.call(['deploy', 'logs', nexus_url, nexus_path, build_url]) + status = subprocess.call(['deploy', 'logs', nexus_url, nexus_path, build_url]) + sys.exit(status) deploy.add_command(archives) diff --git a/lftools/cli/version.py b/lftools/cli/version.py index f70d3723..8e987277 100644 --- a/lftools/cli/version.py +++ b/lftools/cli/version.py @@ -66,7 +66,8 @@ def bump(ctx, release_tag): 3. Change x.y.z-SNAPSHOT versions to x.(y+1).0-SNAPSHOT 4. Change x.y.z-RELEASE_TAG versions to x.y.(z+1)-SNAPSHOT and """ - subprocess.call(['version', 'bump', release_tag]) + status = subprocess.call(['version', 'bump', release_tag]) + sys.exit(status) @click.command() @@ -78,7 +79,8 @@ def release(ctx, release_tag): Searches poms for all instances of SNAPSHOT version and changes it to RELEASE_TAG. """ - subprocess.call(['version', 'release', release_tag]) + status = subprocess.call(['version', 'release', release_tag]) + sys.exit(status) @click.command() @@ -97,7 +99,8 @@ def patch(ctx, release_tag, patch_dir, project): if not os.path.isdir(patch_dir): print("{} is not a valid directory.".format(patch_dir)) sys.exit(404) - subprocess.call(['version', 'patch', release_tag, patch_dir, project]) + status = subprocess.call(['version', 'patch', release_tag, patch_dir, project]) + sys.exit(status) version.add_command(bump)