Fix each machine index machine yielder

This commit is contained in:
sophia 2021-08-10 14:41:42 -04:00 committed by Paul Hinze
parent 47a0a2d7d2
commit 83495a4f8b
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 12 additions and 6 deletions

View File

@ -68,7 +68,6 @@ func (t *TargetIndex) Set(entry core.Target) (updatedEntry core.Target, err erro
Target: target.target,
},
)
// TODO: check if this actually gets back a full target
updatedEntry, err = NewTarget(
t.ctx,
WithTargetName(updatedTarget.Target.Name),

View File

@ -76,16 +76,21 @@ module Vagrant
end
# Iterate over every machine in the index
def each(reload=false)
def each(reload=true)
if reload
arg_machines = @client.all()
@logger.debug("machines args: #{arg_machines}")
arg_machines.each do |m|
@machines << machine_to_entry(m)
e = machine_to_entry(m)
@machines[e.id] = e
end
end
@logger.debug("machines: #{@machines.keys}")
@machines.each do |uuid, data|
yield Entry.new(uuid, data.merge("id" => uuid))
yield data
end
end
@ -108,13 +113,15 @@ module Vagrant
"local_data_path" => machine_client.get_local_data_path(),
# TODO: get the provider!
"provider" => "virtualbox",
"state" => machine_client.get_state(),
"state" => machine_client.get_state().id,
"vagrantfile_name" => machine_client.get_vagrantfile_name(),
"vagrantfile_path" => machine_client.get_vagrantfile_path(),
"machine_client" => machine_client,
}
id = machine_client.get_id()
@logger.debug("machine id: #{id}")
entry = Vagrant::MachineIndex::Entry.new(
id=machine_client.resource_id, raw=raw
id=id, raw=raw
)
return entry
end