git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/branches/0.9.8.x@246 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2008/11/05 14:12:41... | ... |
@@ -1,5 +1,8 @@ |
1 | 1 |
2008-11-05 Michal Ludvig <michal@logix.cz> |
2 | 2 |
|
3 |
+ * s3cmd, S3/S3.py, S3/Exceptions.py: Don't abort 'sync' or 'put' on files |
|
4 |
+ that can't be open (e.g. Permision denied). Print a warning and skip over |
|
5 |
+ instead. |
|
3 | 6 |
* S3/S3.py: Escape parameters in strings. Fixes sync to and |
4 | 7 |
ls of directories with spaces. (Thx Lubomir Rintel from Fedora Project) |
5 | 8 |
|
... | ... |
@@ -157,12 +157,12 @@ class S3(object): |
157 | 157 |
|
158 | 158 |
def object_put(self, filename, bucket, object, extra_headers = None): |
159 | 159 |
if not os.path.isfile(filename): |
160 |
- raise ParameterError("%s is not a regular file" % filename) |
|
160 |
+ raise InvalidFileError("%s is not a regular file" % filename) |
|
161 | 161 |
try: |
162 | 162 |
file = open(filename, "rb") |
163 | 163 |
size = os.stat(filename)[ST_SIZE] |
164 | 164 |
except IOError, e: |
165 |
- raise ParameterError("%s: %s" % (filename, e.strerror)) |
|
165 |
+ raise InvalidFileError("%s: %s" % (filename, e.strerror)) |
|
166 | 166 |
headers = SortedDict() |
167 | 167 |
if extra_headers: |
168 | 168 |
headers.update(extra_headers) |
... | ... |
@@ -200,6 +200,9 @@ def cmd_object_put(args): |
200 | 200 |
except S3UploadError, e: |
201 | 201 |
error("Upload of '%s' failed too many times. Skipping that file." % real_filename) |
202 | 202 |
continue |
203 |
+ except InvalidFileError, e: |
|
204 |
+ warning("File can not be uploaded: %s" % e) |
|
205 |
+ continue |
|
203 | 206 |
speed_fmt = formatSize(response["speed"], human_readable = True, floating_point = True) |
204 | 207 |
output("File '%s' stored as %s (%d bytes in %0.1f seconds, %0.2f %sB/s) [%d of %d]" % |
205 | 208 |
(file, uri_final, response["size"], response["elapsed"], speed_fmt[0], speed_fmt[1], |
... | ... |
@@ -618,6 +621,9 @@ def cmd_sync_local2remote(src, dst): |
618 | 618 |
except S3UploadError, e: |
619 | 619 |
error("%s: upload failed too many times. Skipping that file." % src) |
620 | 620 |
continue |
621 |
+ except InvalidFileError, e: |
|
622 |
+ warning("File can not be uploaded: %s" % e) |
|
623 |
+ continue |
|
621 | 624 |
speed_fmt = formatSize(response["speed"], human_readable = True, floating_point = True) |
622 | 625 |
output("File '%s' stored as %s (%d bytes in %0.1f seconds, %0.2f %sB/s) [%d of %d]" % |
623 | 626 |
(src, uri, response["size"], response["elapsed"], speed_fmt[0], speed_fmt[1], |