|
|
|
@ -199,13 +199,25 @@ func (z *Zone) SyncRegions() error {
|
|
|
|
|
err := z.syncZoneRegions() |
|
|
|
|
if err == nil { |
|
|
|
|
z.ForEachMachine(func(p *Machine) bool { |
|
|
|
|
err = z.syncMachineRegions(p) |
|
|
|
|
return err != nil |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (*Zone) syncMachineRegions(p *Machine) error { |
|
|
|
|
var err error |
|
|
|
|
|
|
|
|
|
if p.IsActive() { |
|
|
|
|
err = p.RemoveFile("region") |
|
|
|
|
} else { |
|
|
|
|
err = p.WriteStringFile("none\n", "region") |
|
|
|
|
} |
|
|
|
|
return err != nil |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
err = p.RemoveFile(RegionClusterTokenFileName) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return err |
|
|
|
|