mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
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. --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c9cd54a845
commit
41f8e0bad6
2 changed files with 8 additions and 5 deletions
3
changelogs/fragments/10176-fix-proxmox_snap_timeout.yml
Normal file
3
changelogs/fragments/10176-fix-proxmox_snap_timeout.yml
Normal 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).
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue