From 13780f37c3f5e5f18f10f131d1ef39c010457e87 Mon Sep 17 00:00:00 2001 From: Daniel Wakefield Date: Wed, 4 Mar 2015 14:01:55 +0000 Subject: 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 --- swiftclient/shell.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'swiftclient/shell.py') 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 ] [--segment-container ] [--leave-segments] [--object-threads ] [--segment-threads ] - [--header
] [--use-slo] + [--header
] [--use-slo] [--ignore-checksum] [--object-name ] ''' @@ -681,6 +681,7 @@ Optional arguments: Upload file and name object to or upload dir and use 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 or upload dir and ' 'use 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 = "[]" -- cgit v1.2.1