diff --git a/cmd/satellite/admin.go b/cmd/satellite/admin.go index af99aa846..cf8e1743c 100644 --- a/cmd/satellite/admin.go +++ b/cmd/satellite/admin.go @@ -22,7 +22,8 @@ func cmdAdminRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } db, err := satellitedb.New(log.Named("db"), runCfg.Database, satellitedb.Options{ @@ -51,7 +52,7 @@ func cmdAdminRun(cmd *cobra.Command, args []string) (err error) { err = db.CheckVersion(ctx) if err != nil { - log.Fatal("Failed satellite database version check.", zap.Error(err)) + log.Error("Failed satellite database version check.", zap.Error(err)) return errs.New("Error checking version for satellitedb: %+v", err) } diff --git a/cmd/satellite/api.go b/cmd/satellite/api.go index 636321fca..be1ecd0dd 100644 --- a/cmd/satellite/api.go +++ b/cmd/satellite/api.go @@ -27,7 +27,8 @@ func cmdAPIRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } db, err := satellitedb.New(log.Named("db"), runCfg.Database, satellitedb.Options{ @@ -91,7 +92,7 @@ func cmdAPIRun(cmd *cobra.Command, args []string) (err error) { err = db.CheckVersion(ctx) if err != nil { - log.Fatal("Failed satellite database version check.", zap.Error(err)) + log.Error("Failed satellite database version check.", zap.Error(err)) return errs.New("Error checking version for satellitedb: %+v", err) } diff --git a/cmd/satellite/gc.go b/cmd/satellite/gc.go index 1ed21946c..8af368098 100644 --- a/cmd/satellite/gc.go +++ b/cmd/satellite/gc.go @@ -24,7 +24,8 @@ func cmdGCRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } db, err := satellitedb.New(log.Named("db"), runCfg.Database, satellitedb.Options{}) @@ -72,8 +73,8 @@ func cmdGCRun(cmd *cobra.Command, args []string) (err error) { err = db.CheckVersion(ctx) if err != nil { - log.Fatal("Failed satellite database version check for GC.", zap.Error(err)) - return errs.New("Error checking version for satellitedb for GC: %+v", err) + log.Error("Failed satellite database version check.", zap.Error(err)) + return errs.New("Error checking version for satellitedb: %+v", err) } runError := peer.Run(ctx) diff --git a/cmd/satellite/main.go b/cmd/satellite/main.go index 54b6382de..8545fd71a 100644 --- a/cmd/satellite/main.go +++ b/cmd/satellite/main.go @@ -346,7 +346,8 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } db, err := satellitedb.New(log.Named("db"), runCfg.Database, satellitedb.Options{ @@ -410,7 +411,7 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { err = db.CheckVersion(ctx) if err != nil { - log.Fatal("Failed satellite database version check.", zap.Error(err)) + log.Error("Failed satellite database version check.", zap.Error(err)) return errs.New("Error checking version for satellitedb: %+v", err) } diff --git a/cmd/satellite/metainfo.go b/cmd/satellite/metainfo.go index 2f8292b26..54683ff16 100644 --- a/cmd/satellite/metainfo.go +++ b/cmd/satellite/metainfo.go @@ -7,7 +7,6 @@ import ( "bufio" "context" "encoding/hex" - "log" "os" "github.com/zeebo/errs" @@ -59,14 +58,15 @@ func runMetainfoCmd(ctx context.Context, cmdFunc func(*metainfo.Service) error) } func runVerifierCmd(ctx context.Context, cmdFunc func(*audit.Verifier) error) error { - logger := zap.L() + log := zap.L() identity, err := dryRunCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } - db, err := satellitedb.New(logger.Named("db"), dryRunCfg.Database, satellitedb.Options{}) + db, err := satellitedb.New(log.Named("db"), dryRunCfg.Database, satellitedb.Options{}) if err != nil { return errs.New("error connecting to master database on satellite: %+v", err) } @@ -79,7 +79,7 @@ func runVerifierCmd(ctx context.Context, cmdFunc func(*audit.Verifier) error) er return errs.New("Error checking version for satellitedb: %+v", err) } - pointerDB, err := metainfo.NewStore(logger.Named("pointerdb"), dryRunCfg.Metainfo.DatabaseURL) + pointerDB, err := metainfo.NewStore(log.Named("pointerdb"), dryRunCfg.Metainfo.DatabaseURL) if err != nil { return errs.New("Error creating metainfo database connection: %+v", err) } @@ -103,19 +103,19 @@ func runVerifierCmd(ctx context.Context, cmdFunc func(*audit.Verifier) error) er dialer := rpc.NewDefaultDialer(tlsOptions) metainfoService := metainfo.NewService( - logger.Named("metainfo:service"), + log.Named("metainfo:service"), pointerDB, db.Buckets(), ) overlayService := overlay.NewService( - logger.Named("overlay"), + log.Named("overlay"), db.OverlayCache(), runCfg.Overlay, ) ordersService, err := orders.NewService( - logger.Named("orders:service"), + log.Named("orders:service"), signing.SignerFromFullIdentity(identity), overlayService, db.Orders(), @@ -131,7 +131,7 @@ func runVerifierCmd(ctx context.Context, cmdFunc func(*audit.Verifier) error) er } verifier := audit.NewVerifier( - logger.Named("audit:verifier"), + log.Named("audit:verifier"), metainfoService, dialer, overlayService, diff --git a/cmd/satellite/repairer.go b/cmd/satellite/repairer.go index 7a392b361..9756f6e45 100644 --- a/cmd/satellite/repairer.go +++ b/cmd/satellite/repairer.go @@ -26,7 +26,8 @@ func cmdRepairerRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } db, err := satellitedb.New(log.Named("db"), runCfg.Database, satellitedb.Options{}) @@ -92,7 +93,7 @@ func cmdRepairerRun(cmd *cobra.Command, args []string) (err error) { err = db.CheckVersion(ctx) if err != nil { - log.Fatal("Failed satellite database version check.", zap.Error(err)) + log.Error("Failed satellite database version check.", zap.Error(err)) return errs.New("Error checking version for satellitedb: %+v", err) } diff --git a/cmd/storagenode/main.go b/cmd/storagenode/main.go index 9df2c2875..32493c63d 100644 --- a/cmd/storagenode/main.go +++ b/cmd/storagenode/main.go @@ -140,7 +140,8 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { identity, err := runCfg.Identity.Load() if err != nil { - log.Fatal("Failed to load identity.", zap.Error(err)) + log.Error("Failed to load identity.", zap.Error(err)) + return errs.New("Failed to load identity: %+v", err) } if err := runCfg.Verify(log); err != nil { diff --git a/storagenode/peer.go b/storagenode/peer.go index 76f06e18c..5c3dfc161 100644 --- a/storagenode/peer.go +++ b/storagenode/peer.go @@ -738,7 +738,7 @@ func (peer *Peer) Run(ctx context.Context) (err error) { } if err := peer.Preflight.LocalTime.Check(ctx); err != nil { - peer.Log.Fatal("Failed preflight check.", zap.Error(err)) + peer.Log.Error("Failed preflight check.", zap.Error(err)) return err } diff --git a/versioncontrol/peer.go b/versioncontrol/peer.go index 4c6f240f8..71d284795 100644 --- a/versioncontrol/peer.go +++ b/versioncontrol/peer.go @@ -180,7 +180,8 @@ func New(log *zap.Logger, config *Config) (peer *Peer, err error) { peer.response, err = json.Marshal(peer.Versions) if err != nil { - peer.Log.Fatal("Error marshalling version info.", zap.Error(err)) + peer.Log.Error("Error marshalling version info.", zap.Error(err)) + return nil, RolloutErr.Wrap(err) } peer.Log.Debug("Setting version info.", zap.ByteString("Value", peer.response))