mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-11-10 06:34:13 +00:00
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:
parent
3d689aa992
commit
742cfe6d74
2 changed files with 9 additions and 0 deletions
2
changelogs/fragments/allow-renaming-networks.yml
Normal file
2
changelogs/fragments/allow-renaming-networks.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- network - Allow renaming networks.
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue