diff --git a/CHANGELOG.md b/CHANGELOG.md index cb0022b9c..cbf505334 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ IMPROVEMENTS: BUG FIXES: + - commands/package: Package with `--base` for VirtualBox doesn't + crash. [GH-3827] - provisioners/puppet: Fix setting facter vars with Windows guests. [GH-3776] - guests/freebsd: Properly register the rsync_pre capability diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 3c62e2a5a..9f80181d9 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -245,15 +245,20 @@ module Vagrant def id=(value) @logger.info("New machine ID: #{value.inspect}") - # The file that will store the id if we have one. This allows the - # ID to persist across Vagrant runs. Also, store the UUID for the - # machine index. - id_file = @data_dir.join("id") + id_file = nil + if @data_dir + # The file that will store the id if we have one. This allows the + # ID to persist across Vagrant runs. Also, store the UUID for the + # machine index. + id_file = @data_dir.join("id") + end if value - # Write the "id" file with the id given. - id_file.open("w+") do |f| - f.write(value) + if id_file + # Write the "id" file with the id given. + id_file.open("w+") do |f| + f.write(value) + end end # If we don't have a UUID, then create one @@ -287,7 +292,7 @@ module Vagrant end else # Delete the file, since the machine is now destroyed - id_file.delete if id_file.file? + id_file.delete if id_file && id_file.file? # If we have a UUID associated with the index, remove it uuid = index_uuid