Fix if the route table changed to none (#49533) (#49703)

* Fix if the route table changed to none (#49533)

(cherry picked from commit 5a59748e6c)

* add changelog
pull/49738/head
Yuwei Zhou 7 years ago committed by Toshio Kuratomi
parent 06ffe7b5d8
commit 0dda61c258

@ -0,0 +1,3 @@
---
bugfixes:
- "Fix if the route table changed to none (https://github.com/ansible/ansible/pull/49533)"

@ -221,6 +221,7 @@ class AzureRMSubnet(AzureRMModuleBase):
if self.security_group: if self.security_group:
nsg = self.parse_nsg() nsg = self.parse_nsg()
route_table = dict()
if self.route_table: if self.route_table:
route_table = self.parse_resource_to_dict(self.route_table) route_table = self.parse_resource_to_dict(self.route_table)
self.route_table = format_resource_id(val=route_table['name'], self.route_table = format_resource_id(val=route_table['name'],
@ -256,7 +257,8 @@ class AzureRMSubnet(AzureRMModuleBase):
if self.route_table != results['route_table'].get('id'): if self.route_table != results['route_table'].get('id'):
changed = True changed = True
results['route_table']['id'] = self.route_table results['route_table']['id'] = self.route_table
self.log("CHANGED: subnet {0} route_table to {1}".format(self.name, route_table['name'])) self.log("CHANGED: subnet {0} route_table to {1}".format(self.name, route_table.get('name')))
elif self.state == 'absent': elif self.state == 'absent':
changed = True changed = True
except CloudError: except CloudError:

Loading…
Cancel
Save