core: Don't set index uuid file if data dir is nil
This commit is contained in:
parent
47b5a3fcdb
commit
cddd878656
|
@ -121,7 +121,8 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
# Keep track of where our UUID should be placed
|
# 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
|
# Initializes the provider last so that it has access to all the
|
||||||
# state we setup on this machine.
|
# state we setup on this machine.
|
||||||
|
@ -232,8 +233,10 @@ module Vagrant
|
||||||
@env.machine_index.release(entry)
|
@env.machine_index.release(entry)
|
||||||
|
|
||||||
# Store our UUID so we can access it later
|
# Store our UUID so we can access it later
|
||||||
@index_uuid_file.open("w+") do |f|
|
if @index_uuid_file
|
||||||
f.write(entry.id)
|
@index_uuid_file.open("w+") do |f|
|
||||||
|
f.write(entry.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -271,6 +274,7 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @return [String] UUID or nil if we don't have one yet.
|
# @return [String] UUID or nil if we don't have one yet.
|
||||||
def index_uuid
|
def index_uuid
|
||||||
|
return nil if !@index_uuid_file
|
||||||
return @index_uuid_file.read.chomp if @index_uuid_file.file?
|
return @index_uuid_file.read.chomp if @index_uuid_file.file?
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue