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)