From 988c7779124b0c99c6c947ddb071fb59fa9aa235 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 1 Nov 2023 11:46:59 -0400 Subject: [PATCH] Properly handle live state with restart confirm If "--live" is passed (the default), we shouldn't confirm to restart the VM as this is not required. Instead only confirm if "--no-live" was passed or if the flag doesn't exist. --- client-cli/pvc/cli/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client-cli/pvc/cli/cli.py b/client-cli/pvc/cli/cli.py index faefc5f9..2538de5c 100644 --- a/client-cli/pvc/cli/cli.py +++ b/client-cli/pvc/cli/cli.py @@ -169,9 +169,10 @@ def restart_opt(function): @wraps(function) def confirm_action(*args, **kwargs): restart_state = kwargs.get("restart_flag", None) + live_state = kwargs.get("live_flag", False) - if restart_state is None: - # Neither "--restart" or "--no-restart" was passed: prompt for restart or restart if "--unsafe" + if restart_state is None and not live_state: + # Neither "--restart" or "--no-restart" was passed, and "--no-live" was passed: prompt for restart or restart if "--unsafe" try: click.confirm( f"Restart VM {kwargs.get('domain')} to apply changes",