mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
feat: allow renaming a volume (#683)
##### SUMMARY Allow renaming volume Fixes #681 ##### ISSUE TYPE - Feature Pull Request ##### COMPONENT NAME `volume` --------- Co-authored-by: Jonas L. <jooola@users.noreply.github.com>
This commit is contained in:
parent
b566c017e2
commit
8c8a52ceed
3 changed files with 35 additions and 1 deletions
|
|
@ -245,10 +245,20 @@ class AnsibleHCloudVolume(AnsibleHCloud):
|
|||
action.wait_until_finished()
|
||||
self._mark_as_changed()
|
||||
|
||||
update_params = {}
|
||||
|
||||
name = self.module.params.get("name")
|
||||
if name is not None and name != self.hcloud_volume.name:
|
||||
self.module.fail_on_missing_params(required_params=["id"])
|
||||
update_params["name"] = name
|
||||
|
||||
labels = self.module.params.get("labels")
|
||||
if labels is not None and labels != self.hcloud_volume.labels:
|
||||
update_params["labels"] = labels
|
||||
|
||||
if update_params:
|
||||
if not self.module.check_mode:
|
||||
self.hcloud_volume.update(labels=labels)
|
||||
self.hcloud_volume.update(**update_params)
|
||||
self._mark_as_changed()
|
||||
|
||||
delete_protection = self.module.params.get("delete_protection")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue