]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
changes
authorMathias Klette <mathias.klette@profitbricks.com>
Tue, 5 Jun 2012 14:30:30 +0000 (16:30 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Tue, 5 Jun 2012 14:30:30 +0000 (16:30 +0200)
debian_build.py

index 2f06b0d40d3a3f5608d6f2275bdd8049e4f9d7e7..071f1e6bcd5787fdb612a642a92f22b0a8cf5282 100755 (executable)
@@ -113,34 +113,27 @@ def read_file(path):
         return result
 
 def dput_package_upload(changes_path):
-    cmd = [BIN_DPUT, '-c', '%s' %(DPUT_CF), '--no-upload-log', 'profitbricks', '%s' %(changes_path)]
-    logger.debug(
-            'Trying to execute: "%s"'
-            %(cmd)
-    )
-    cmd_obj = subprocess.Popen(
-            cmd,
-            shell=False,
-            stdout=sys.stdout,
-            stderr=sys.stderr,
-            close_fds=True,
-            cwd=os.path.dirname(DPUT_CF)
-    )
+    try:
+        cmd = [BIN_DPUT, '-c', '%s' %(DPUT_CF), '--no-upload-log', 'profitbricks', '%s' %(changes_path)]
+        logger.debug( 'Trying to execute: "%s"' %(cmd))
+        cmd_obj = subprocess.Popen(
+                cmd,
+                shell=False,
+                stdout=sys.stdout,
+                stderr=subprocess.STDOUT,
+                close_fds=True,
+                cwd=os.path.dirname(DPUT_CF)
+        )
 
-    ret = cmd_obj.wait()
+        ret = cmd_obj.wait()
+        logger.debug('Exit status: %d' %( ret ))
 
-    if ret:
-        message = (
-                '"%s" returned non-zero (returned with: %s).'
-                %(' '.join(cmd), ret)
-        )
-        logger.debug(message)
-        raise Exception(message)
+        if ret:
+            raise Exception(message)
+
+    except Exception, error:
+        logger.exception('%s' %(error))
 
-    message = (
-            '"%s" returned zero.' %(' '.join(cmd))
-    )
-    logger.debug(message)
     return True
 
 def create_dput_cfg():