From 4aa875f94d6fde2e76874d1796c95c905bd593f2 Mon Sep 17 00:00:00 2001 From: Vallari Agrawal Date: Mon, 8 Jul 2024 14:13:12 +0530 Subject: [PATCH] services/kill.py: optionally add boolean value flag in kill cmd For example, value of "--preserve-queues" is boolean in /kill request schema. If it's true, add it to the kill cmd, otherwise don't add the flag. Signed-off-by: Vallari Agrawal --- src/teuthology_api/services/kill.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/teuthology_api/services/kill.py b/src/teuthology_api/services/kill.py index 7034180..7cc5ea6 100644 --- a/src/teuthology_api/services/kill.py +++ b/src/teuthology_api/services/kill.py @@ -50,9 +50,11 @@ async def run(args, send_logs: bool, token: dict, request: Request): try: kill_cmd = [f"{TEUTHOLOGY_PATH}/virtualenv/bin/teuthology-kill"] for flag, flag_value in args.items(): - if isinstance(flag_value, bool): - flag_value = int(flag_value) - kill_cmd += [flag, str(flag_value)] + if isinstance(flag_value, bool): # check for --preserve-queues + if flag_value == True: + kill_cmd += [flag] + else: + kill_cmd += [flag, str(flag_value)] log.info(kill_cmd) proc = subprocess.Popen( kill_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT