Keepalived lease errors on startup no longer fatal
This commit modifies how keepalived startup works, so that when lease
errors are encountered, sensu-backend does not crash.
@@ -217,7 +217,7 @@ func (k *Keepalived) initFromStore(ctx context.Context) error {
tctx, cancel := context.WithTimeout(entityCtx, k.storeTimeout)
defer cancel()
if err := switches.BuryAndRevokeLease(tctx, id); err != nil {
- return err
+ logger.WithError(err).WithField("keepalive", id).Error("error burying switch")
}
continue
}
@@ -236,7 +236,8 @@ func (k *Keepalived) initFromStore(ctx context.Context) error {
tctx, cancel = context.WithTimeout(entityCtx, k.storeTimeout)
defer cancel()
if err := switches.Dead(tctx, id, ttl); err != nil {
- return fmt.Errorf("error initializing keepalive %q: %s", id, err)
+ logger.WithError(err).WithField("keepalive", id).Error("error initializing keepalive")
+ continue
}
}
