build-sys: make make happy with core.Wrap
Signed-off-by: Nagy Károly Gábriel <k@jpi.io>
This commit is contained in:
@@ -51,7 +51,7 @@ func (m *Cluster) scanDirectory(opts *ScanOptions) error {
|
||||
ok, err := m.scanSubdirectory(opts, e.Name())
|
||||
switch {
|
||||
case err != nil:
|
||||
return core.Wrap(err, e.Name())
|
||||
return core.Wrap(err, "cannot scan directory %q", e.Name())
|
||||
case !ok:
|
||||
m.warn(nil).
|
||||
WithField("zone", e.Name()).
|
||||
@@ -220,7 +220,7 @@ func (z *Zone) loadRegions() error {
|
||||
// parsed
|
||||
err = z.appendRegions(regions...)
|
||||
if err != nil {
|
||||
err = core.Wrap(err, filename)
|
||||
err = core.Wrap(err, "cannot append region from file %q", filename)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ func (z *Zone) loadClusterToken() error {
|
||||
|
||||
err = z.zones.setRegionClusterToken(z.Name, token)
|
||||
if err != nil {
|
||||
err = core.Wrap(err, filename)
|
||||
err = core.Wrap(err, "wrong cluster token in file %q", filename)
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
@@ -36,7 +36,7 @@ func (m *Machine) GetWireguardKeys(ringID rings.RingID) (wireguard.KeyPair, erro
|
||||
out.PrivateKey, err = wireguard.PrivateKeyFromBase64(string(data))
|
||||
if err != nil {
|
||||
// bad key
|
||||
err = core.Wrap(err, keyFile)
|
||||
err = core.Wrap(err, "bad private key in file %q", keyFile)
|
||||
return out, err
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (m *Machine) GetWireguardKeys(ringID rings.RingID) (wireguard.KeyPair, erro
|
||||
out.PublicKey, err = wireguard.PublicKeyFromBase64(string(data))
|
||||
if err != nil {
|
||||
// bad key
|
||||
err = core.Wrap(err, pubFile)
|
||||
err = core.Wrap(err, "bad public key in %q", pubFile)
|
||||
return out, err
|
||||
}
|
||||
}
|
||||
@@ -227,10 +227,10 @@ func (m *Machine) applyWireguardPeerConfig(ring rings.RingID,
|
||||
switch {
|
||||
case !found:
|
||||
// unknown
|
||||
return core.Wrap(ErrUnknownNode, pc.Endpoint.Host)
|
||||
return core.Wrap(ErrUnknownNode, "peer %q not found", pc.Endpoint.Host)
|
||||
case ring == 1 && m.zone != peer.zone:
|
||||
// invalid zone
|
||||
return core.Wrap(ErrInvalidNode, peer.Name)
|
||||
return core.Wrap(ErrInvalidNode, "peer %q invalid zone", peer.Name)
|
||||
default:
|
||||
// apply RingInfo
|
||||
ri := &RingInfo{
|
||||
|
||||
@@ -36,12 +36,12 @@ func (m *Machine) UpdatePublicAddresses() error {
|
||||
|
||||
func (m *Machine) init() error {
|
||||
if err := m.setID(); err != nil {
|
||||
return core.Wrap(err, m.Name)
|
||||
return core.Wrap(err, "cannot set ID for machine %q", m.Name)
|
||||
}
|
||||
|
||||
for _, ring := range Rings {
|
||||
if err := m.tryReadWireguardKeys(ring.ID); err != nil {
|
||||
return core.Wrap(err, m.Name)
|
||||
return core.Wrap(err, "cannot read keys for machine %q", m.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user