From 582e3b368aeff7b612ed016c60bb9ac00c5cfd7a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 27 Jan 2018 14:32:42 -0500 Subject: [PATCH] halt: check that machine is running before attempting to clear tmpfiles Otherwise, running `vagrant halt` on a stopped machine would make us crash. Particularly annoying in multi-machines environments. ref #406 --- lib/vagrant-lxc/action.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index ccd67b2..21f8e3a 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -125,7 +125,9 @@ module Vagrant end b2.use ClearForwardedPorts - b2.use RemoveTemporaryFiles + if env[:machine].state.id == :running + b2.use RemoveTemporaryFiles + end b2.use GcPrivateNetworkBridges b2.use Builtin::Call, Builtin::GracefulHalt, :stopped, :running do |env2, b3| if !env2[:result]