From cddd87865668d4cc290d59665be9e9fe4173c109 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 5 Apr 2014 11:30:06 -0700 Subject: [PATCH] core: Don't set index uuid file if data dir is nil --- lib/vagrant/machine.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 9ed774a9b..83a7f4f78 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -121,7 +121,8 @@ module Vagrant end # Keep track of where our UUID should be placed - @index_uuid_file = @data_dir.join("index_uuid") + @index_uuid_file = nil + @index_uuid_file = @data_dir.join("index_uuid") if @data_dir # Initializes the provider last so that it has access to all the # state we setup on this machine. @@ -232,8 +233,10 @@ module Vagrant @env.machine_index.release(entry) # Store our UUID so we can access it later - @index_uuid_file.open("w+") do |f| - f.write(entry.id) + if @index_uuid_file + @index_uuid_file.open("w+") do |f| + f.write(entry.id) + end end end else @@ -271,6 +274,7 @@ module Vagrant # # @return [String] UUID or nil if we don't have one yet. def index_uuid + return nil if !@index_uuid_file return @index_uuid_file.read.chomp if @index_uuid_file.file? return nil end