[PR #10176/41f8e0ba backport][stable-10] Properly handle proxmox_snap timeout parameter (#10220)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled

Properly handle proxmox_snap timeout parameter (#10176)

* fix: issue #10175

There is some code to handle timeout, but due to an erroneous while
test, it was never called. Use timeout >= 0 instead of timeout, so the
timeout code can be called, and properly handle timeout.

* add changelog

* Adjust changelog fragment.

---------


(cherry picked from commit 41f8e0bad6)

Co-authored-by: GuillaumeV-cemea <101114641+GuillaumeV-cemea@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2025-06-07 17:30:02 +02:00 committed by GitHub
parent 8bffd757ce
commit 4a642c247c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- proxmox_snap - correctly handle proxmox_snap timeout parameter (https://github.com/ansible-collections/community.proxmox/issues/73, https://github.com/ansible-collections/community.proxmox/issues/95, https://github.com/ansible-collections/community.general/pull/10176).

View file

@ -190,7 +190,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
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 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
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 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
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 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
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 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
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: