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

chore: comment

This commit is contained in:
jo 2025-11-05 16:12:42 +01:00
parent 0753da505d
commit d14a08dbcc
No known key found for this signature in database
GPG key ID: B2FEC9B22722B984
2 changed files with 4 additions and 0 deletions

View file

@ -192,6 +192,8 @@ class AnsibleHCloudLoadBalancerNetwork(AnsibleHCloud):
if ip_range is not None:
ip_range_network = ip_network(ip_range)
if ip_range_network not in [ip_network(o.ip_range) for o in self.hcloud_network.subnets]:
# Validate before "detach" instead of relying on the "attach" API
# validation, leaving the resource in a half applied state.
self.module.fail_json(msg=f"ip_range '{ip_range}' was not found in the network subnets")
if ip_address(self.hcloud_load_balancer_network.ip) not in ip_range_network:

View file

@ -206,6 +206,8 @@ class AnsibleHCloudServerNetwork(AnsibleHCloud):
if ip_range is not None:
ip_range_network = ip_network(ip_range)
if ip_range_network not in [ip_network(o.ip_range) for o in self.hcloud_network.subnets]:
# Validate before "detach" instead of relying on the "attach" API
# validation, leaving the resource in a half applied state.
self.module.fail_json(msg=f"ip_range '{ip_range}' was not found in the network subnets")
if ip_address(self.hcloud_server_network.ip) not in ip_range_network: