Skip to content

Commit

Permalink
services/kill.py: optionally add boolean value flag in kill cmd
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
VallariAg committed Jul 18, 2024
1 parent f246efa commit 779b632
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/teuthology_api/services/kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 779b632

Please sign in to comment.