def destroy_vms(self):
"""
Destroy target VMs. Operates on all available VMs if none are specified.
"""
for vm in self.vms:
# Vagrant will return 1 if VM to be destroyed does not exist.
if vm.state != "not_created":
self.v.destroy(vm_name=vm.name)
# Destroy a second time because the vagrant-digitalocean plugin
# doesn't clean up after itself:
# https://github.com/smdahlen/vagrant-digitalocean/issues/194
if vm.provider == "digital_ocean":
try:
self.v.destroy(vm_name=vm.name)
except CalledProcessError:
pass
评论列表
文章目录