mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
hcloud_volume: Force detaching volume on deletion
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
2a7d7ceb65
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…
Add table
Add a link
Reference in a new issue