switch the deletion order (#57102)

pull/57115/head
MyronFanQiu 5 years ago committed by Yunge Zhu
parent b1a92a37b4
commit a56a9e1eeb

@ -1774,9 +1774,6 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
except Exception as exc:
self.fail("Error deleting virtual machine {0} - {1}".format(self.name, str(exc)))
if 'all' in self.remove_on_absent or 'all_autocreated' in self.remove_on_absent:
self.remove_autocreated_resources(vm.tags)
# TODO: parallelize nic, vhd, and public ip deletions with begin_deleting
# TODO: best-effort to keep deleting other linked resources if we encounter an error
if self.remove_on_absent.intersection(set(['all', 'virtual_storage'])):
@ -1785,6 +1782,9 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
self.log('Deleting managed disks')
self.delete_managed_disks(managed_disk_ids)
if 'all' in self.remove_on_absent or 'all_autocreated' in self.remove_on_absent:
self.remove_autocreated_resources(vm.tags)
if self.remove_on_absent.intersection(set(['all', 'network_interfaces'])):
self.log('Deleting network interfaces')
for nic_dict in nic_names:

Loading…
Cancel
Save