fix: fail when baked talos iso is missing
This commit is contained in:
parent
370dd7f29c
commit
816999a01f
|
|
@ -52,11 +52,13 @@ def ensure_image(base_url, token, node, node_address, storage, image_url, filena
|
||||||
"url": image_url,
|
"url": image_url,
|
||||||
})
|
})
|
||||||
wait_for_task(base_url, token, node, task.get("data"))
|
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:
|
if network_config_path:
|
||||||
build_custom_iso(base_url, token, node_address, storage, source_filename, filename, 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)
|
response = api_request(base_url, token, "GET", content_path)
|
||||||
for item in response.get("data", []):
|
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):
|
for _ in range(180):
|
||||||
response = api_request(base_url, token, "GET", content_path)
|
response = api_request(base_url, token, "GET", content_path)
|
||||||
if any(item.get("volid", "").endswith(filename) for item in response.get("data", [])):
|
if any(item.get("volid", "").endswith(filename) for item in response.get("data", [])):
|
||||||
return
|
return True
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
raise RuntimeError(f"timed out waiting for {filename} to appear in {node}/{storage}")
|
return False
|
||||||
|
|
||||||
|
|
||||||
def run_ssh(node_address, script):
|
def run_ssh(node_address, script):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue