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
This commit is contained in:
Yuwei Zhou 2018-12-11 02:17:42 +08:00 committed by Toshio Kuratomi
parent 06ffe7b5d8
commit 0dda61c258
2 changed files with 6 additions and 1 deletions

View file

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

View file

@ -221,6 +221,7 @@ class AzureRMSubnet(AzureRMModuleBase):
if self.security_group:
nsg = self.parse_nsg()
route_table = dict()
if self.route_table:
route_table = self.parse_resource_to_dict(self.route_table)
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'):
changed = True
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':
changed = True
except CloudError: