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():