diff --git a/terraform/scripts/stage_talos_image.py b/terraform/scripts/stage_talos_image.py index 93b3b57..979bc2c 100644 --- a/terraform/scripts/stage_talos_image.py +++ b/terraform/scripts/stage_talos_image.py @@ -52,11 +52,13 @@ def ensure_image(base_url, token, node, node_address, storage, image_url, filena "url": image_url, }) wait_for_task(base_url, token, node, task.get("data")) - wait_for_storage_content(base_url, token, node, storage, source_filename) + if not wait_for_storage_content(base_url, token, node, storage, source_filename): + raise RuntimeError(f"download task finished but {source_filename} was not found in {storage}") if network_config_path: build_custom_iso(base_url, token, node_address, storage, source_filename, filename, network_config_path) - wait_for_storage_content(base_url, token, node, storage, filename) + if not wait_for_storage_content(base_url, token, node, storage, filename): + raise RuntimeError(f"custom Talos ISO {filename} was not found in {storage} after baking") response = api_request(base_url, token, "GET", content_path) for item in response.get("data", []): @@ -88,9 +90,9 @@ def wait_for_storage_content(base_url, token, node, storage, filename): for _ in range(180): response = api_request(base_url, token, "GET", content_path) if any(item.get("volid", "").endswith(filename) for item in response.get("data", [])): - return + return True time.sleep(2) - raise RuntimeError(f"timed out waiting for {filename} to appear in {node}/{storage}") + return False def run_ssh(node_address, script):