Browse Source

zones: scan for Machine details after they've all been added

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head
Alejandro Mery 1 year ago
parent
commit
06e755ecd2
  1. 4
      pkg/zones/machine_scan.go
  2. 16
      pkg/zones/scan.go

4
pkg/zones/machine_scan.go

@ -24,3 +24,7 @@ func (m *Machine) updatePublicAddresses() error {
m.PublicAddresses = addrs
return nil
}
func (m *Machine) scan() error {
return m.updatePublicAddresses()
}

16
pkg/zones/scan.go

@ -43,13 +43,19 @@ func (z *Zone) scan() error {
Name: e.Name(),
}
if err := m.updatePublicAddresses(); err != nil {
return err
}
z.Machines = append(z.Machines, m)
}
}
return nil
return z.scanMachines()
}
func (z *Zone) scanMachines() error {
var err error
z.zones.ForEachMachine(func(m *Machine) {
if err == nil {
err = m.scan()
}
})
return err
}

Loading…
Cancel
Save