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
|
||||
|
||||
# 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,10 +233,12 @@ module Vagrant
|
|||
@env.machine_index.release(entry)
|
||||
|
||||
# Store our UUID so we can access it later
|
||||
if @index_uuid_file
|
||||
@index_uuid_file.open("w+") do |f|
|
||||
f.write(entry.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
# Delete the file, since the machine is now destroyed
|
||||
id_file.delete if id_file.file?
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue