fix non location error (#52312)

pull/52476/head
Yuwei Zhou 6 years ago committed by Yunge Zhu
parent d6453a79f5
commit 2daaf4eedd

@ -184,7 +184,7 @@ def subnet_to_dict(subnet):
result['route_table']['name'] = id_keys['routeTables'] result['route_table']['name'] = id_keys['routeTables']
result['route_table']['resource_group'] = id_keys['resourceGroups'] result['route_table']['resource_group'] = id_keys['resourceGroups']
if subnet.service_endpoints: if subnet.service_endpoints:
result['service_endpoints'] = [{'service': item.service, 'locations': item.locations} for item in subnet.service_endpoints] result['service_endpoints'] = [{'service': item.service, 'locations': item.locations or []} for item in subnet.service_endpoints]
return result return result
@ -283,12 +283,14 @@ class AzureRMSubnet(AzureRMModuleBase):
oldd = {} oldd = {}
for item in self.service_endpoints: for item in self.service_endpoints:
name = item['service'] name = item['service']
oldd[name] = {'service': name, 'locations': item['locations'].sort()} locations = item.get('locations') or []
oldd[name] = {'service': name, 'locations': locations.sort()}
newd = {} newd = {}
if 'service_endpoints' in results: if 'service_endpoints' in results:
for item in results['service_endpoints']: for item in results['service_endpoints']:
name = item['service'] name = item['service']
newd[name] = {'service': name, 'locations': item['locations'].sort()} locations = item.get('locations') or []
newd[name] = {'service': name, 'locations': locations.sort()}
if newd != oldd: if newd != oldd:
changed = True changed = True
results['service_endpoints'] = self.service_endpoints results['service_endpoints'] = self.service_endpoints

Loading…
Cancel
Save