From 62b0fc06e069eb7bd6958913264f884d2f894365 Mon Sep 17 00:00:00 2001 From: host Date: Sat, 1 Aug 2026 13:43:35 +0300 Subject: [PATCH] =?UTF-8?q?fix(pve1):=20task=5Ftimeout=20=D0=B2=20Valves,?= =?UTF-8?q?=20Optional[template=5Fvmid],=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B0=D0=B9=D0=BC?= =?UTF-8?q?=D0=B0=D1=83=D1=82=D0=BE=D0=B2=20=D0=BE=D0=B6=D0=B8=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxmox_tools_pve1.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/proxmox_tools_pve1.py b/proxmox_tools_pve1.py index 6637fde..cd9db7e 100644 --- a/proxmox_tools_pve1.py +++ b/proxmox_tools_pve1.py @@ -43,6 +43,9 @@ class Tools: request_timeout: int = Field( default=30, description="HTTP request timeout in seconds" ) + task_timeout: int = Field( + default=120, description="Timeout for waiting Proxmox tasks (creation, cloning) in seconds" + ) def __init__(self): self.valves = self.Valves() @@ -477,7 +480,7 @@ class Tools: out.append(f"UPID: {upid}") if wait and upid: out.append("Waiting for creation to finish...") - ok, msg = self._wait_for_task(upid, node=node, timeout=120) + ok, msg = self._wait_for_task(upid, node=node, timeout=self.valves.task_timeout) out.append(" Creation done" if ok else f" WARN Creation may not have finished: {msg}") return "\n".join(out) except Exception as e: @@ -615,7 +618,7 @@ class Tools: out.append(f"UPID: {upid}") out.append("Waiting for clone to finish...") clone_node = target_node or node - ok, msg = self._wait_for_task(upid, node=clone_node, timeout=120) + ok, msg = self._wait_for_task(upid, node=clone_node, timeout=self.valves.task_timeout) out.append(" Clone done" if ok else f" WARN Clone may not have finished: {msg}") config_params = {} if memory is not None: @@ -662,7 +665,7 @@ class Tools: self, vmid: int, name: str, - template_vmid: Optional[int] = 999, + template_vmid: Optional[int] = None, memory: int = 4096, cores: int = 2, disk_size: str = "32G", @@ -708,7 +711,7 @@ class Tools: node = node or self.valves.default_node bridge = bridge or self.valves.default_bridge try: - if template_vmid: + if template_vmid is not None: return self.pve1_vm_create_from_template( vmid=vmid, name=name, template_vmid=template_vmid, full=True, memory=memory, cores=cores, storage=disk_storage, @@ -749,8 +752,8 @@ class Tools: out.append(f"UPID: {upid}") if wait and upid: out.append("Waiting for creation to finish...") - ok, msg = self._wait_for_task(upid, node=node, timeout=120) + ok, msg = self._wait_for_task(upid, node=node, timeout=self.valves.task_timeout) out.append(" Creation done" if ok else f" WARN Creation may not have finished: {msg}") return "\n".join(out) except Exception as e: - return "ERR " + str(e) \ No newline at end of file + return "ERR " + str(e)