core: don't delete data dir if no data dir [GH-4017]

This commit is contained in:
Mitchell Hashimoto 2014-06-12 11:30:10 -07:00
parent 0a5f6bb77e
commit 4f0e527f5d
2 changed files with 10 additions and 7 deletions

View File

@ -6,6 +6,7 @@ IMPROVEMENTS:
BUG FIXES:
- commands/package: base package won't crash with exception [GH-4017]
- hosts/windows: RDP command works without crash. [GH-3962]
- provisioners/puppet: Properly escape facter variables for PowerShell
on Windows guests. [GH-3959]

View File

@ -301,13 +301,15 @@ module Vagrant
@env.machine_index.delete(entry) if entry
end
# Delete the entire data directory contents since all state
# associated with the VM is now gone.
@data_dir.children.each do |child|
begin
child.rmtree
rescue Errno::EACCES
@logger.info("EACCESS deleting file: #{child}")
if @data_dir
# Delete the entire data directory contents since all state
# associated with the VM is now gone.
@data_dir.children.each do |child|
begin
child.rmtree
rescue Errno::EACCES
@logger.info("EACCESS deleting file: #{child}")
end
end
end
end