From e491573654d5fb84cb8539516fca1a69496a4dba Mon Sep 17 00:00:00 2001 From: Gevorg Davoian Date: Fri, 30 Sep 2016 12:27:08 +0300 Subject: [PATCH] Fix simulator bool command line args --debug, --is-cast and --is-fanout are defined as args of type=bool. This means that, for example, if we want to enable debug logging level, we have to type '--debug True'. But we can also use '--debug False' in order to do the same, which is very misleading (in fact, any non-empty string will evaluate to True). This patch tries to solve this problem by replacing type=bool and default=False with action='store_true' for these args, so that we will be able to enable them (they will remain False by default as before) simply as '--debug' etc. Change-Id: I8ee04c35427df446966161491da8d264b44975bf --- tools/simulator.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/simulator.py b/tools/simulator.py index 8a3ff5a70..c4c2308f4 100755 --- a/tools/simulator.py +++ b/tools/simulator.py @@ -601,8 +601,7 @@ def main(): parser.add_argument('--url', dest='url', default='rabbit://guest:password@localhost/', help="oslo.messaging transport url") - parser.add_argument('-d', '--debug', dest='debug', type=bool, - default=False, + parser.add_argument('-d', '--debug', dest='debug', action='store_true', help="Turn on DEBUG logging level instead of WARN") parser.add_argument('-tp', '--topic', dest='topic', default="profiler_topic", @@ -659,10 +658,10 @@ def main(): client.add_argument('--exit-wait', dest='exit_wait', type=int, default=0, help='Keep connections open N seconds after calls ' 'have been done') - client.add_argument('--is-cast', dest='is_cast', type=bool, default=False, + client.add_argument('--is-cast', dest='is_cast', action='store_true', help='Use `call` or `cast` RPC methods') - client.add_argument('--is-fanout', dest='is_fanout', type=bool, - default=False, help='fanout=True for CAST messages') + client.add_argument('--is-fanout', dest='is_fanout', action='store_true', + help='fanout=True for CAST messages') args = parser.parse_args()