fix: wait for custom talos iso visibility
This commit is contained in:
parent
aecbf392bc
commit
f854710025
|
|
@ -53,6 +53,7 @@ def ensure_image(base_url, token, node, storage, image_url, filename, network_co
|
||||||
|
|
||||||
if network_config_path:
|
if network_config_path:
|
||||||
build_custom_iso(base_url, token, node, storage, source_filename, filename, network_config_path)
|
build_custom_iso(base_url, token, node, storage, source_filename, filename, network_config_path)
|
||||||
|
wait_for_storage_content(base_url, token, node, storage, filename)
|
||||||
|
|
||||||
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", []):
|
||||||
|
|
@ -79,6 +80,16 @@ def wait_for_task(base_url, token, node, upid):
|
||||||
raise RuntimeError("timed out waiting for ISO download task to finish")
|
raise RuntimeError("timed out waiting for ISO download task to finish")
|
||||||
|
|
||||||
|
|
||||||
|
def wait_for_storage_content(base_url, token, node, storage, filename):
|
||||||
|
content_path = f"/api2/json/nodes/{node}/storage/{storage}/content"
|
||||||
|
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
|
||||||
|
time.sleep(2)
|
||||||
|
raise RuntimeError(f"timed out waiting for {filename} to appear in {node}/{storage}")
|
||||||
|
|
||||||
|
|
||||||
def detect_proxmox_iso_dir(storage):
|
def detect_proxmox_iso_dir(storage):
|
||||||
candidates = [
|
candidates = [
|
||||||
Path("/var/lib/vz/template/iso"),
|
Path("/var/lib/vz/template/iso"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue