mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-11-10 06:34:13 +00:00
hcloud_volume: Force detaching volume on deletion (#95)
Force detaching of volumes before deleting when they are still attached to a server. This makes it easier for tools like molecule to see the correct state.
This commit is contained in:
parent
5d6b5b7c3f
commit
f4b336a444
2 changed files with 4 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- hcloud_volume Force detaching of volumes on servers before deletion
|
|
@ -294,6 +294,8 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
self._get_volume()
|
||||
if self.hcloud_volume is not None:
|
||||
if not self.module.check_mode:
|
||||
if self.hcloud_volume.server is not None:
|
||||
self.hcloud_volume.detach().wait_until_finished()
|
||||
self.client.volumes.delete(self.hcloud_volume)
|
||||
self._mark_as_changed()
|
||||
self.hcloud_volume = None
|
||||
|
|
Loading…
Reference in a new issue