Merge "Check threads number options validation"
This commit is contained in:
commit
985c038209
@ -93,11 +93,11 @@ def st_delete(parser, args, output_manager):
|
|||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--object-threads', type=int,
|
'', '--object-threads', type=int,
|
||||||
default=10, help='Number of threads to use for deleting objects. '
|
default=10, help='Number of threads to use for deleting objects. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--container-threads', type=int,
|
'', '--container-threads', type=int,
|
||||||
default=10, help='Number of threads to use for deleting containers. '
|
default=10, help='Number of threads to use for deleting containers. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
(options, args) = parse_args(parser, args)
|
(options, args) = parse_args(parser, args)
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
if (not args and not options.yes_all) or (args and options.yes_all):
|
if (not args and not options.yes_all) or (args and options.yes_all):
|
||||||
@ -106,6 +106,22 @@ def st_delete(parser, args, output_manager):
|
|||||||
st_delete_help)
|
st_delete_help)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if options.object_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --object-threads should be a positive integer.'
|
||||||
|
'\n\nUsage: %s delete %s\n%s',
|
||||||
|
BASENAME, st_delete_options,
|
||||||
|
st_delete_help)
|
||||||
|
return
|
||||||
|
|
||||||
|
if options.container_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --container-threads should be a positive integer.'
|
||||||
|
'\n\nUsage: %s delete %s\n%s',
|
||||||
|
BASENAME, st_delete_options,
|
||||||
|
st_delete_help)
|
||||||
|
return
|
||||||
|
|
||||||
_opts = vars(options)
|
_opts = vars(options)
|
||||||
_opts['object_dd_threads'] = options.object_threads
|
_opts['object_dd_threads'] = options.object_threads
|
||||||
with SwiftService(options=_opts) as swift:
|
with SwiftService(options=_opts) as swift:
|
||||||
@ -273,11 +289,11 @@ def st_download(parser, args, output_manager):
|
|||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--object-threads', type=int,
|
'', '--object-threads', type=int,
|
||||||
default=10, help='Number of threads to use for downloading objects. '
|
default=10, help='Number of threads to use for downloading objects. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--container-threads', type=int, default=10,
|
'', '--container-threads', type=int, default=10,
|
||||||
help='Number of threads to use for downloading containers. '
|
help='Number of threads to use for downloading containers. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--no-download', action='store_true',
|
'', '--no-download', action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
@ -319,6 +335,20 @@ def st_download(parser, args, output_manager):
|
|||||||
st_download_options, st_download_help)
|
st_download_options, st_download_help)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if options.object_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --object-threads should be a positive integer.\n\n'
|
||||||
|
'Usage: %s download %s\n%s', BASENAME,
|
||||||
|
st_download_options, st_download_help)
|
||||||
|
return
|
||||||
|
|
||||||
|
if options.container_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --container-threads should be a positive integer.'
|
||||||
|
'\n\nUsage: %s download %s\n%s', BASENAME,
|
||||||
|
st_download_options, st_download_help)
|
||||||
|
return
|
||||||
|
|
||||||
_opts = vars(options)
|
_opts = vars(options)
|
||||||
_opts['object_dd_threads'] = options.object_threads
|
_opts['object_dd_threads'] = options.object_threads
|
||||||
with SwiftService(options=_opts) as swift:
|
with SwiftService(options=_opts) as swift:
|
||||||
@ -804,11 +834,11 @@ def st_upload(parser, args, output_manager):
|
|||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--object-threads', type=int, default=10,
|
'', '--object-threads', type=int, default=10,
|
||||||
help='Number of threads to use for uploading full objects. '
|
help='Number of threads to use for uploading full objects. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'', '--segment-threads', type=int, default=10,
|
'', '--segment-threads', type=int, default=10,
|
||||||
help='Number of threads to use for uploading object segments. '
|
help='Number of threads to use for uploading object segments. '
|
||||||
'Default is 10.')
|
'Its value must be a positive integer. Default is 10.')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'-H', '--header', action='append', dest='header',
|
'-H', '--header', action='append', dest='header',
|
||||||
default=[], help='Set request headers with the syntax header:value. '
|
default=[], help='Set request headers with the syntax header:value. '
|
||||||
@ -861,6 +891,20 @@ def st_upload(parser, args, output_manager):
|
|||||||
output_manager.error("segment-size should be positive")
|
output_manager.error("segment-size should be positive")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if options.object_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --object-threads should be a positive integer.'
|
||||||
|
'\n\nUsage: %s upload %s\n%s', BASENAME, st_upload_options,
|
||||||
|
st_upload_help)
|
||||||
|
return
|
||||||
|
|
||||||
|
if options.segment_threads <= 0:
|
||||||
|
output_manager.error(
|
||||||
|
'ERROR: option --segment-threads should be a positive integer.'
|
||||||
|
'\n\nUsage: %s upload %s\n%s', BASENAME, st_upload_options,
|
||||||
|
st_upload_help)
|
||||||
|
return
|
||||||
|
|
||||||
_opts = vars(options)
|
_opts = vars(options)
|
||||||
_opts['object_uu_threads'] = options.object_threads
|
_opts['object_uu_threads'] = options.object_threads
|
||||||
with SwiftService(options=_opts) as swift:
|
with SwiftService(options=_opts) as swift:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user