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
This commit is contained in:
Virgil Dupras 2018-01-27 14:32:42 -05:00
parent 6738febaa2
commit 582e3b368a

View file

@ -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]