summaryrefslogtreecommitdiff
path: root/swiftclient/shell.py
diff options
context:
space:
mode:
authorDaniel Wakefield <daniel.wakefield@hp.com>2015-03-04 14:01:55 +0000
committerDaniel Wakefield <daniel.wakefield@hp.com>2015-03-04 14:01:55 +0000
commit13780f37c3f5e5f18f10f131d1ef39c010457e87 (patch)
tree88fcf8f9b626a40bac3a74555a3afb7cbb39063a /swiftclient/shell.py
parent925c01ebfbdfb6478a3786f24a9572deae40f8f8 (diff)
downloadpython-swiftclient-13780f37c3f5e5f18f10f131d1ef39c010457e87.tar.gz
Add improvements to MD5 validation.
With MD5Sum checking being added, a concern was brought up that It was a change with no possibility of reverting to the old behaviour. This change adds the flag '--ignore-checksum' to the upload subcommand allowing the checks to be turned off. Changed occurrences of the magic string for a null md5 to use a descriptive constant instead. Updated Error messages generated when validation fails. They should now be more descriptive and not output a literal newline sequence. Change-Id: Id1756cbb6700bb7e38f0ee0e75bc535e37f777ed
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-xswiftclient/shell.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index 439a92f..3d3ef51 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -637,7 +637,7 @@ def st_post(parser, args, output_manager):
st_upload_options = '''[--changed] [--skip-identical] [--segment-size <size>]
[--segment-container <container>] [--leave-segments]
[--object-threads <thread>] [--segment-threads <threads>]
- [--header <header>] [--use-slo]
+ [--header <header>] [--use-slo] [--ignore-checksum]
[--object-name <object-name>]
<container> <file_or_directory>
'''
@@ -681,6 +681,7 @@ Optional arguments:
Upload file and name object to <object-name> or upload
dir and use <object-name> as object prefix instead of
folder name.
+ --ignore-checksum Turn off checksum validation for uploads.
'''.strip('\n')
@@ -733,6 +734,9 @@ def st_upload(parser, args, output_manager):
'', '--object-name', dest='object_name',
help='Upload file and name object to <object-name> or upload dir and '
'use <object-name> as object prefix instead of folder name.')
+ parser.add_option(
+ '', '--ignore-checksum', dest='checksum', default=True,
+ action='store_false', help='Turn off checksum validation for uploads.')
(options, args) = parse_args(parser, args)
args = args[1:]
if len(args) < 2:
@@ -848,7 +852,7 @@ def st_upload(parser, args, output_manager):
output_manager.error("%s" % error)
except SwiftError as e:
- output_manager.error("%s" % e)
+ output_manager.error(e.value)
st_capabilities_options = "[<proxy_url>]"