Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c07bf85d3 | |||
| d71dd99c15 | |||
| 135f098bf1 | |||
| f79123caee | |||
| 99998dc7e8 | |||
| 892d849740 | |||
| 242c1e9067 | |||
| 125a4c0dbe | |||
| 7c811d7813 |
+1
-1
@@ -52,7 +52,7 @@ func populateDNSManager(mgr *dns.Manager, m *cluster.Cluster) error {
|
|||||||
|
|
||||||
m.ForEachZone(func(z *cluster.Zone) bool {
|
m.ForEachZone(func(z *cluster.Zone) bool {
|
||||||
z.ForEachMachine(func(p *cluster.Machine) bool {
|
z.ForEachMachine(func(p *cluster.Machine) bool {
|
||||||
err = mgr.AddHost(ctx, z.Name, p.ID, p.Active(), p.PublicAddresses...)
|
err = mgr.AddHost(ctx, z.Name, p.ID, p.IsActive(), p.PublicAddresses...)
|
||||||
return err != nil
|
return err != nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ func (m *Machine) FullName() string {
|
|||||||
return strings.Join(name, ".")
|
return strings.Join(name, ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Active indicates the machine is to be included in regions' DNS entries
|
// IsActive indicates the machine is to be included in regions' DNS entries
|
||||||
func (m *Machine) Active() bool {
|
func (m *Machine) IsActive() bool {
|
||||||
return !m.Inactive
|
return !m.Inactive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (r *Region) ForEachMachine(fn func(*Machine) bool) {
|
|||||||
var term bool
|
var term bool
|
||||||
|
|
||||||
z.ForEachMachine(func(p *Machine) bool {
|
z.ForEachMachine(func(p *Machine) bool {
|
||||||
if p.Active() {
|
if p.IsActive() {
|
||||||
term = fn(p)
|
term = fn(p)
|
||||||
}
|
}
|
||||||
return term
|
return term
|
||||||
@@ -178,7 +178,7 @@ func (z *Zone) SyncRegions() error {
|
|||||||
err := z.syncZoneRegions()
|
err := z.syncZoneRegions()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
z.ForEachMachine(func(p *Machine) bool {
|
z.ForEachMachine(func(p *Machine) bool {
|
||||||
if p.Active() {
|
if p.IsActive() {
|
||||||
err = p.RemoveFile("region")
|
err = p.RemoveFile("region")
|
||||||
} else {
|
} else {
|
||||||
err = p.WriteStringFile("none\n", "region")
|
err = p.WriteStringFile("none\n", "region")
|
||||||
|
|||||||
+8
-10
@@ -54,25 +54,23 @@ func (pub PublicKey) String() string {
|
|||||||
// UnmarshalText loads the value from base64
|
// UnmarshalText loads the value from base64
|
||||||
func (key *PrivateKey) UnmarshalText(b []byte) error {
|
func (key *PrivateKey) UnmarshalText(b []byte) error {
|
||||||
v, err := PrivateKeyFromBase64(string(b))
|
v, err := PrivateKeyFromBase64(string(b))
|
||||||
switch {
|
if err != nil {
|
||||||
case err != nil:
|
|
||||||
return err
|
return err
|
||||||
default:
|
|
||||||
*key = v
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*key = v
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalText loads the value from base64
|
// UnmarshalText loads the value from base64
|
||||||
func (pub *PublicKey) UnmarshalText(b []byte) error {
|
func (pub *PublicKey) UnmarshalText(b []byte) error {
|
||||||
v, err := PublicKeyFromBase64(string(b))
|
v, err := PublicKeyFromBase64(string(b))
|
||||||
switch {
|
if err != nil {
|
||||||
case err != nil:
|
|
||||||
return err
|
return err
|
||||||
default:
|
|
||||||
*pub = v
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*pub = v
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes the key for JSON, omitting empty.
|
// MarshalJSON encodes the key for JSON, omitting empty.
|
||||||
|
|||||||
Reference in New Issue
Block a user