From d1232f0c20e4f80e7780a3ead133af3bc142e36f Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Thu, 19 May 2022 14:18:22 +0100 Subject: [PATCH] Only call destroy on active networks (#1497) When removing networks, skip calling destroy to deactivate the network if it is not currently active. This avoids errors when the host has been rebooted and vagrant machines are removed as the networks are typically not automatically started. --- lib/vagrant-libvirt/action/destroy_networks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/action/destroy_networks.rb b/lib/vagrant-libvirt/action/destroy_networks.rb index 0a2642c..77b2cf6 100644 --- a/lib/vagrant-libvirt/action/destroy_networks.rb +++ b/lib/vagrant-libvirt/action/destroy_networks.rb @@ -68,7 +68,7 @@ module VagrantPlugins # Shutdown network first. # Undefine network. begin - libvirt_network.destroy + libvirt_network.destroy if libvirt_network.active? libvirt_network.undefine @logger.info 'Undefined it' rescue => e