diff options
author | John Dickinson <me@not.mn> | 2012-10-18 12:08:38 -0700 |
---|---|---|
committer | John Dickinson <me@not.mn> | 2012-10-18 12:08:38 -0700 |
commit | 2562381e1c181438f796ed286fc4f7644379cfb8 (patch) | |
tree | 0639ea37a28638f7de44e364901b9cfe92f2abad | |
parent | c2e4e1c14674c18b87e843a085d9a99ff1223b1c (diff) | |
download | swift-bench-2562381e1c181438f796ed286fc4f7644379cfb8.tar.gz |
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
-rwxr-xr-x | bin/swift-bench | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/swift-bench b/bin/swift-bench index edeb511..cd4f7c3 100755 --- a/bin/swift-bench +++ b/bin/swift-bench @@ -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) |