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

switch the deletion order (#57102)

This commit is contained in:
MyronFanQiu 2019-05-29 17:11:54 +08:00 committed by Yunge Zhu
parent b1a92a37b4
commit a56a9e1eeb

View file

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