Cache machines in machine index

This commit is contained in:
sophia 2021-08-10 09:53:01 -04:00 committed by Paul Hinze
parent 8808ef353e
commit c5e6a97892
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -26,6 +26,7 @@ module Vagrant
# @param [Entry] entry The entry to delete.
# @return [Boolean] true if delete is successful
def delete(entry)
@machines.delete(entry.id)
machine = entry.remote_machine.client.ref
@client.delete(machine)
end
@ -65,6 +66,7 @@ module Vagrant
# @param [Entry] entry
# @return [Entry]
def set(entry)
@machines[entry.id] = entry
entry.remote_machine.client.save
entry
end
@ -73,6 +75,17 @@ module Vagrant
#no-op
end
# Iterate over every machine in the index
def each(reload=false)
if reload
end
@machines.each do |uuid, data|
yield Entry.new(uuid, data.merge("id" => uuid))
end
end
protected
# Converts a machine to a machine index entry