fix: allow renaming networks (#449)

##### SUMMARY

The network could not be renamed before. This was discovered while
working on #448

##### ISSUE TYPE


- Feature Pull Request


##### COMPONENT NAME

network
This commit is contained in:
Jonas L 2024-02-02 12:53:54 +01:00 committed by GitHub
parent 3d689aa992
commit 742cfe6d74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- network - Allow renaming networks.

View file

@ -173,6 +173,13 @@ class AnsibleHCloudNetwork(AnsibleHCloud):
def _update_network(self):
try:
name = self.module.params.get("name")
if name is not None and self.hcloud_network.name != name:
self.module.fail_on_missing_params(required_params=["id"])
if not self.module.check_mode:
self.hcloud_network.update(name=name)
self._mark_as_changed()
labels = self.module.params.get("labels")
if labels is not None and labels != self.hcloud_network.labels:
if not self.module.check_mode: