1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix non location error (#52312)

This commit is contained in:
Yuwei Zhou 2019-02-18 13:54:41 +08:00 committed by Yunge Zhu
parent d6453a79f5
commit 2daaf4eedd

View file

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