diff --git a/changelogs/fragments/10176-fix-proxmox_snap_timeout.yml b/changelogs/fragments/10176-fix-proxmox_snap_timeout.yml new file mode 100644 index 00000000000..1217b9d55e4 --- /dev/null +++ b/changelogs/fragments/10176-fix-proxmox_snap_timeout.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - proxmox - correctly handle proxmox_snap timeout parameter (//github.com/ansible-collections/community.general/pull/10176) diff --git a/plugins/modules/proxmox_snap.py b/plugins/modules/proxmox_snap.py index 158efe99ec7..9abc5cf1add 100644 --- a/plugins/modules/proxmox_snap.py +++ b/plugins/modules/proxmox_snap.py @@ -190,7 +190,7 @@ def _container_mp_restore(self, vm, vmid, timeout, unbind, mountpoints, vmstatus def start_instance(self, vm, vmid, timeout): taskid = self.vmstatus(vm, vmid).start.post() - while timeout: + while timeout >= 0: if self.api_task_ok(vm['node'], taskid): return True timeout -= 1 @@ -202,7 +202,7 @@ def start_instance(self, vm, vmid, timeout): def shutdown_instance(self, vm, vmid, timeout): taskid = self.vmstatus(vm, vmid).shutdown.post() - while timeout: + while timeout >= 0: if self.api_task_ok(vm['node'], taskid): return True timeout -= 1 @@ -245,7 +245,7 @@ def snapshot_create(self, vm, vmid, timeout, snapname, description, vmstate, unb else: taskid = self.snapshot(vm, vmid).post(snapname=snapname, description=description, vmstate=int(vmstate)) - while timeout: + while timeout >= 0: if self.api_task_ok(vm['node'], taskid): break if timeout == 0: @@ -265,7 +265,7 @@ def snapshot_remove(self, vm, vmid, timeout, snapname, force): return True taskid = self.snapshot(vm, vmid).delete(snapname, force=int(force)) - while timeout: + while timeout >= 0: if self.api_task_ok(vm['node'], taskid): return True if timeout == 0: @@ -281,7 +281,7 @@ def snapshot_rollback(self, vm, vmid, timeout, snapname): return True taskid = self.snapshot(vm, vmid)(snapname).post("rollback") - while timeout: + while timeout >= 0: if self.api_task_ok(vm['node'], taskid): return True if timeout == 0: