fix(kubevirt_vm): Allow switching between running and run_strategy

Allow switching between running and run_strategy by always clearing the
other value. E.g. if run_strategy was provided then running set to None
to clear it or vice versa.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
Felix Matouschek
2025-04-28 17:19:19 +02:00
parent 0b542ddced
commit aeb98d241c
2 changed files with 16 additions and 0 deletions

View File

@@ -333,7 +333,9 @@ def create_vm(params: Dict) -> Dict:
if (run_strategy := params.get("run_strategy")) is not None:
vm["spec"]["runStrategy"] = run_strategy
vm["spec"]["running"] = None
else:
vm["spec"]["runStrategy"] = None
vm["spec"]["running"] = (
running if (running := params.get("running")) is not None else True
)