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:
John Dickinson 2012-10-18 12:08:38 -07:00
parent c2e4e1c146
commit 2562381e1c
1 changed files with 7 additions and 2 deletions

View File

@ -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)