fix(kubevirt_vm): Set wait_condition based on running

To properly wait for a state change in the kubevirt_vm module the
wait_condition needs to adapted to the state of running.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
Felix Matouschek
2024-04-24 12:17:09 +02:00
parent 81418d7a30
commit 86cee0172f
2 changed files with 96 additions and 1 deletions

View File

@@ -380,7 +380,14 @@ def main() -> None:
module.params["resource_definition"] = render_template(module.params)
# Set wait_condition to allow waiting for the ready state of the VirtualMachine
module.params["wait_condition"] = {"type": "Ready", "status": True}
if module.params["running"]:
module.params["wait_condition"] = {"type": "Ready", "status": True}
else:
module.params["wait_condition"] = {
"type": "Ready",
"status": False,
"reason": "VMINotExists",
}
try:
runner.run_module(module)