Hi.

Debian bugreport w/ attached patch to fix the issue.

--- Begin Message ---
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.000000000 +0200
+++ s3cmd	2012-04-16 13:52:48.000000000 +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(u"Exitting 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(u"Upload of '%s' failed too many times. Skipping that file." % full_name_orig)
+			failures += 1
 			continue
 		except InvalidFileError, e:
 			warning(u"File 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(u"Removing 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)

--- End Message ---
-- 

Attachment: pgpRcs877g0ah.pgp
Description: PGP signature

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
S3tools-general mailing list
S3tools-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/s3tools-general

Reply via email to