diff scripts/hvresources/uploader.py @ 504:b6eb94378ca9 prerelease

update_board
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 22 Jun 2016 01:24:55 +0100
parents 83e1acf38d35
children a084456960c9
line wrap: on
line diff
--- a/scripts/hvresources/uploader.py	Wed Jun 22 01:17:57 2016 +0100
+++ b/scripts/hvresources/uploader.py	Wed Jun 22 01:24:55 2016 +0100
@@ -7,6 +7,7 @@
 import requests
 import shutil
 import stat
+import sys
 import tempfile
 import time
 import urlparse
@@ -149,7 +150,7 @@
     except Exception as e:
         print "{0}Error:{1} {2}".format(Colours.red, Colours.end, e)
         shutil.rmtree(temp_dir) # clean up the temporary directory
-        return
+        sys.exit(1)
 
     post_data["name"] = args.name
 
@@ -271,7 +272,7 @@
         for i,x in enumerate(r_json["errors"]):
             print "{3}) {0}Error:{1} {2}".format(
                 Colours.red, Colours.end, x["detail"], i+1)
-        return
+        sys.exit(2)
 
     # retrieve all requested files
     for i,g in enumerate(args.gen):
@@ -315,6 +316,7 @@
     print "Job URL:", reply_json["data"]["links"]["self"]
     print "Total request time: {0}ms".format(int(1000.0*(time.time()-tick)))
     print "Heavy version:", reply_json["meta"]["version"]
+    sys.exit(0) # success!
 
 def __get_file_url_for_generator(json_api, g):
     """Returns the file link for a specific generator.