Ensure shell scripts exit with proper status codes 36/5136/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 9 Jun 2017 21:35:58 +0000 (17:35 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 9 Jun 2017 21:36:50 +0000 (17:36 -0400)
Otherwise shell scripts called by lftools will return success which may
be incorrect.

Change-Id: I607dd7d5047da51446b953e27a9d48c31c16736c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
lftools/cli/deploy.py
lftools/cli/version.py

index cde4fbb..318b14f 100644 (file)
@@ -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)
index f70d372..8e98727 100644 (file)
@@ -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)