Bug#669002: s3cmd put does not set non-zero exit code on failure

2012-04-22 Thread Mikhail Gusarov
forwarded 669002 http://article.gmane.org/gmane.comp.file-systems.s3.s3tools/452
stop processing here

Thanks, forwarded upstream


Twas brillig at 13:59:44 16.04.2012 UTC+02 when os...@osk.mine.nu did gyre and 
gimble:

 OL Package: s3cmd
 OL Version: 0.9.9.91-1
 OL Severity: normal

 OL s3cmd put does not set non-zero exit code on failure, making it almost 
unusable in automatic backup scripts.
 OL Attached is a patch to fix that. I believe this problem exists in 1.0.0 as 
well.

 OL Regards,

 OL Oskar Liljeblad

 OL -- System Information:
 OL Debian Release: 6.0.4
 OL   APT prefers stable
 OL   APT policy: (500, 'stable'), (1, 'experimental')
 OL Architecture: amd64 (x86_64)

 OL Kernel: Linux 3.2.1 (SMP w/2 CPU cores)
 OL Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
 OL Shell: /bin/sh linked to /bin/bash

-- 



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#669002: s3cmd put does not set non-zero exit code on failure

2012-04-16 Thread Oskar Liljeblad
Package: s3cmd
Version: 0.9.9.91-1
Severity: normal

s3cmd put does not set non-zero exit code on failure, making it almost 
unusable in automatic backup scripts.
Attached is a patch to fix that. I believe this problem exists in 1.0.0 as well.

Regards,

Oskar Liljeblad

-- System Information:
Debian Release: 6.0.4
  APT prefers stable
  APT policy: (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.1 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff -u s3cmd.v0 s3cmd
--- s3cmd.v0	2012-04-16 13:44:05.0 +0200
+++ s3cmd	2012-04-16 13:52:48.0 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 
 ## Amazon S3 manager
 ## Author: Michal Ludvig mic...@logix.cz
@@ -322,6 +322,7 @@
 		warning(uExitting now because of --dry-run)
 		return
 
+	failures = 0
 	seq = 0
 	for key in local_list:
 		seq += 1
@@ -338,9 +339,11 @@
 			response = s3.object_put(full_name, uri_final, extra_headers, extra_label = seq_label)
 		except S3UploadError, e:
 			error(uUpload of '%s' failed too many times. Skipping that file. % full_name_orig)
+			failures += 1
 			continue
 		except InvalidFileError, e:
 			warning(uFile can not be uploaded: %s % e)
+			failures += 1
 			continue
 		speed_fmt = formatSize(response[speed], human_readable = True, floating_point = True)
 		if not Config().progress_meter:
@@ -354,6 +357,9 @@
 			debug(uRemoving temporary encrypted file: %s % unicodise(full_name))
 			os.remove(full_name)
 
+	if failures  0:
+		sys.exit(1)
+
 def cmd_object_get(args):
 	cfg = Config()
 	s3 = S3(cfg)