fix config parsing in swift-bench -x
This patch ensures that the command-line arg format (boolean) doesn't conflict with the conf file format (string) and the proper action is taken. Change-Id: I3284096e1a9478897e1c3246ab190b46d2590243
This commit is contained in:
parent
78e2ffab6c
commit
af4b2851fc
@ -23,7 +23,7 @@ from optparse import OptionParser
|
||||
|
||||
from swift.common.bench import (BenchController, DistributedBenchController,
|
||||
create_containers, delete_containers)
|
||||
from swift.common.utils import readconf, LogAdapter
|
||||
from swift.common.utils import readconf, LogAdapter, TRUE_VALUES
|
||||
|
||||
# The defaults should be sufficient to run swift-bench on a SAIO
|
||||
CONF_DEFAULTS = {
|
||||
@ -137,6 +137,11 @@ if __name__ == '__main__':
|
||||
options.del_concurrency = options.concurrency
|
||||
options.containers = ['%s_%d' % (options.container_name, i)
|
||||
for i in xrange(int(options.num_containers))]
|
||||
# check boolean options vs config parameter values
|
||||
if str(options.delete).lower() in TRUE_VALUES:
|
||||
options.delete = 'yes'
|
||||
else:
|
||||
options.delete = 'no'
|
||||
|
||||
def sigterm(signum, frame):
|
||||
sys.exit('Termination signal received.')
|
||||
@ -165,5 +170,5 @@ if __name__ == '__main__':
|
||||
controller = controller_class(logger, options)
|
||||
controller.run()
|
||||
|
||||
if options.delete:
|
||||
if options.delete.lower() in TRUE_VALUES:
|
||||
delete_containers(logger, options)
|
||||
|
Loading…
x
Reference in New Issue
Block a user