1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

fix: Don't detach volume if no server defined

and volume already attached to another server
This commit is contained in:
shaerpour 2025-05-05 13:38:05 +03:30
parent 3c84f19ef5
commit ed038a1116
No known key found for this signature in database
GPG key ID: D89285D72B39ED8F

View file

@ -244,12 +244,6 @@ class AnsibleHCloudVolume(AnsibleHCloud):
action = self.hcloud_volume.attach(server, automount=automount)
action.wait_until_finished()
self._mark_as_changed()
else:
if self.hcloud_volume.server is not None:
if not self.module.check_mode:
action = self.hcloud_volume.detach()
action.wait_until_finished()
self._mark_as_changed()
labels = self.module.params.get("labels")
if labels is not None and labels != self.hcloud_volume.labels: