Skip to content

Commit

Permalink
don't shout "not found" for patches
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Jan 26, 2024
1 parent 5dec0b0 commit a8b65a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/registry/file/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
apierrors "github.com/kubescape/storage/vendor/k8s.io/apimachinery/pkg/api/errors"

Check failure on line 8 in pkg/registry/file/storage.go

View workflow job for this annotation

GitHub Actions / pr-created / test / Create cross-platform build

github.com/kubescape/storage/vendor/k8s.io/apimachinery/pkg/api/errors must be imported as k8s.io/apimachinery/pkg/api/errors

Check failure on line 8 in pkg/registry/file/storage.go

View workflow job for this annotation

GitHub Actions / pr-created / test / Create cross-platform build

no required module provides package github.com/kubescape/storage/vendor/k8s.io/apimachinery/pkg/api/errors; to add it:

Check failure on line 8 in pkg/registry/file/storage.go

View workflow job for this annotation

GitHub Actions / pr-created / test / Create cross-platform build

github.com/kubescape/storage/vendor/k8s.io/apimachinery/pkg/api/errors must be imported as k8s.io/apimachinery/pkg/api/errors
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -466,7 +467,9 @@ func (s *StorageImpl) GuaranteedUpdate(
if err != nil {
// If our data is already up-to-date, return the error
if origStateIsCurrent {
logger.L().Ctx(ctx).Error("tryUpdate func failed", helpers.Error(err), helpers.String("key", key))
if !apierrors.IsNotFound(err) {
logger.L().Ctx(ctx).Error("tryUpdate func failed", helpers.Error(err), helpers.String("key", key))
}
return err
}

Expand All @@ -485,7 +488,9 @@ func (s *StorageImpl) GuaranteedUpdate(

// it turns out our cached data was not stale, return the error
if cachedRev == origState.rev {
logger.L().Ctx(ctx).Error("tryUpdate func failed", helpers.Error(err), helpers.String("key", key))
if !apierrors.IsNotFound(err) {
logger.L().Ctx(ctx).Error("tryUpdate func failed", helpers.Error(err), helpers.String("key", key))
}
return cachedUpdateErr
}

Expand Down

0 comments on commit a8b65a8

Please sign in to comment.