diff --git a/lib/vagrant/machine_index/remote.rb b/lib/vagrant/machine_index/remote.rb index a15503f20..3810867bc 100644 --- a/lib/vagrant/machine_index/remote.rb +++ b/lib/vagrant/machine_index/remote.rb @@ -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