From 4608e75b4875dc475b2baefd8785814ff8d20c81 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 31 Aug 2013 23:02:16 -0700 Subject: [PATCH] core: clean up machine directory when id = nil --- lib/vagrant/machine.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 8147bb346..0e951e4e7 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -207,6 +207,12 @@ module Vagrant else # Delete the file, since the machine is now destroyed id_file.delete if id_file.file? + + # Delete the entire data directory contents since all state + # associated with the VM is now gone. + @data_dir.children.each do |child| + child.rmtree + end end # Store the ID locally