Merge "Updated allocation pool checks"

This commit is contained in:
Zuul
2020-05-10 14:21:01 +00:00
committed by Gerrit Code Review
3 changed files with 71 additions and 3 deletions

View File

@@ -205,15 +205,15 @@ def _needs_update(subnet, module, cloud, filters=None):
no_gateway_ip = module.params['no_gateway_ip']
dns = module.params['dns_nameservers']
host_routes = module.params['host_routes']
curr_pool = subnet['allocation_pools'][0]
curr_pool = dict(start=pool_start, end=pool_end)
if subnet['enable_dhcp'] != enable_dhcp:
return True
if subnet_name and subnet['name'] != subnet_name:
return True
if pool_start and curr_pool['start'] != pool_start:
if not subnet['allocation_pools'] and pool_start and pool_end:
return True
if pool_end and curr_pool['end'] != pool_end:
if subnet['allocation_pools'] and curr_pool not in subnet['allocation_pools']:
return True
if gateway_ip and subnet['gateway_ip'] != gateway_ip:
return True
@@ -352,6 +352,8 @@ 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,