diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-06-06 10:33:25 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-06-06 10:33:25 +0000 |
commit | c91c8d575e86b480270f8dfb7df49355dd38ee54 (patch) | |
tree | ee60b5dfa7a88a2e607c02f84a885ac4b1fa99d2 /swiftclient | |
parent | e1e2678cd0a99955c280a813e10c6ce7494389cd (diff) | |
parent | 69bf4634b972ef2ee0ec1f015d71223203f0bb1a (diff) | |
download | python-swiftclient-c91c8d575e86b480270f8dfb7df49355dd38ee54.tar.gz |
Merge "Add an option: disable etag check on downloads"
Diffstat (limited to 'swiftclient')
-rw-r--r-- | swiftclient/service.py | 8 | ||||
-rwxr-xr-x | swiftclient/shell.py | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py index 12d3f21..6ccba55 100644 --- a/swiftclient/service.py +++ b/swiftclient/service.py @@ -336,7 +336,7 @@ class _SwiftReader(object): errors on failures caused by either invalid md5sum or size of the data read. """ - def __init__(self, path, body, headers): + def __init__(self, path, body, headers, checksum=True): self._path = path self._body = body self._actual_read = 0 @@ -345,7 +345,7 @@ class _SwiftReader(object): self._expected_etag = headers.get('etag') if ('x-object-manifest' not in headers - and 'x-static-large-object' not in headers): + and 'x-static-large-object' not in headers and checksum): self._actual_md5 = md5() if 'content-length' in headers: @@ -980,6 +980,7 @@ class SwiftService(object): 'header': [], 'skip_identical': False, 'out_directory': None, + 'checksum': True, 'out_file': None, 'remove_prefix': False, 'shuffle' : False @@ -1135,7 +1136,8 @@ class SwiftService(object): headers_receipt = time() - obj_body = _SwiftReader(path, body, headers) + obj_body = _SwiftReader(path, body, headers, + options.get('checksum', True)) no_file = options['no_download'] if out_file == "-" and not no_file: diff --git a/swiftclient/shell.py b/swiftclient/shell.py index 486dc48..ef165d8 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -204,7 +204,7 @@ def st_delete(parser, args, output_manager): st_download_options = '''[--all] [--marker <marker>] [--prefix <prefix>] [--output <out_file>] [--output-dir <out_directory>] - [--object-threads <threads>] + [--object-threads <threads>] [--ignore-checksum] [--container-threads <threads>] [--no-download] [--skip-identical] [--remove-prefix] [--header <header:value>] [--no-shuffle] @@ -251,6 +251,7 @@ Optional arguments: Example --header "content-type:text/plain" --skip-identical Skip downloading files that are identical on both sides. + --ignore-checksum Turn off checksum validation for downloads. --no-shuffle By default, when downloading a complete account or container, download order is randomised in order to reduce the load on individual drives when multiple @@ -309,6 +310,9 @@ def st_download(parser, args, output_manager): default=False, help='Skip downloading files that are identical on ' 'both sides.') parser.add_argument( + '--ignore-checksum', action='store_false', dest='checksum', + default=True, help='Turn off checksum validation for downloads.') + parser.add_argument( '--no-shuffle', action='store_false', dest='shuffle', default=True, help='By default, download order is randomised in order ' 'to reduce the load on individual drives when multiple clients are ' |