From 59d93bf37720ee2509fd3a0faa567814c5c3121d 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 d18fce1..ff59957 100644 --- a/src/teuthology_api/services/kill.py +++ b/src/teuthology_api/services/kill.py @@ -52,9 +52,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