cluster: load regions when scanning a directory
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -106,6 +106,38 @@ func (m *Cluster) setRegionZones(name string, zones ...*Zone) {
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Cluster) appendRegionRegions(name string, subs ...string) {
|
||||
for i := range m.Regions {
|
||||
r := &m.Regions[i]
|
||||
|
||||
if name == r.Name {
|
||||
// found
|
||||
r.Regions = append(r.Regions, subs...)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// new
|
||||
m.Regions = append(m.Regions, Region{
|
||||
Name: name,
|
||||
Regions: subs,
|
||||
})
|
||||
}
|
||||
|
||||
func (z *Zone) appendRegions(regions ...string) error {
|
||||
for _, s := range regions {
|
||||
// TODO: validate
|
||||
z.debug().
|
||||
WithField("zone", z.Name).
|
||||
WithField("region", s).
|
||||
Print("attached")
|
||||
|
||||
z.Regions = append(z.Regions, s)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cluster) finishRegion(r *Region) {
|
||||
if r.m != nil {
|
||||
// ready
|
||||
|
||||
Reference in New Issue
Block a user