mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-07 05:43:15 +00:00
Fix subnets update and idempotency
Fix subnet idempotency for allocation pools, see the linked story. Return updated subnet information. Remove adding allocation pools that were introduced in Ib8becf5e958f1bc8e5c9fd76f1722536bf1c9f1a in order to add allocation pools, either add new variable or recreate the subnet. Task: 41307 Story: 2008384 Change-Id: Ibe808227de159c6975dc94ef8ad0ab03a9345e17
This commit is contained in:
committed by
siavashsardari
parent
393b484e5a
commit
134a8e9d23
@@ -207,7 +207,7 @@ def _needs_update(subnet, module, cloud, filters=None):
|
||||
return True
|
||||
if not subnet['allocation_pools'] and pool_start and pool_end:
|
||||
return True
|
||||
if subnet['allocation_pools'] and curr_pool not in subnet['allocation_pools']:
|
||||
if subnet['allocation_pools'] != [curr_pool]:
|
||||
return True
|
||||
if gateway_ip and subnet['gateway_ip'] != gateway_ip:
|
||||
return True
|
||||
@@ -346,16 +346,14 @@ def main():
|
||||
changed = True
|
||||
else:
|
||||
if _needs_update(subnet, module, cloud, filters):
|
||||
if subnet['allocation_pools'] and pool is not None:
|
||||
pool = pool + subnet['allocation_pools']
|
||||
cloud.update_subnet(subnet['id'],
|
||||
subnet_name=subnet_name,
|
||||
enable_dhcp=enable_dhcp,
|
||||
gateway_ip=gateway_ip,
|
||||
disable_gateway_ip=no_gateway_ip,
|
||||
dns_nameservers=dns,
|
||||
allocation_pools=pool,
|
||||
host_routes=host_routes)
|
||||
subnet = cloud.update_subnet(subnet['id'],
|
||||
subnet_name=subnet_name,
|
||||
enable_dhcp=enable_dhcp,
|
||||
gateway_ip=gateway_ip,
|
||||
disable_gateway_ip=no_gateway_ip,
|
||||
dns_nameservers=dns,
|
||||
allocation_pools=pool,
|
||||
host_routes=host_routes)
|
||||
changed = True
|
||||
else:
|
||||
changed = False
|
||||
|
||||
Reference in New Issue
Block a user