Skip to content

Commit

Permalink
Suppress NotFound error logging on delete calls (#4057)
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Torkildsen <mortent@google.com>
  • Loading branch information
mortent authored Oct 11, 2023
1 parent be8ac77 commit 0079beb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion porch/pkg/cache/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ func (r *cachedRepository) refreshAllCachedPackages(ctx context.Context) (map[re
r.id, nn.Namespace, nn.Name)
metaPackage, err := r.metadataStore.Delete(ctx, nn, true)
if err != nil {
klog.Warningf("repo %s: error deleting PkgRevMeta %s: %v", r.id, nn, err)
if !apierrors.IsNotFound(err) {
klog.Warningf("repo %s: error deleting PkgRevMeta %s: %v", r.id, nn, err)
}
metaPackage = meta.PackageRevisionMeta{
Name: nn.Name,
Namespace: nn.Namespace,
Expand Down
4 changes: 3 additions & 1 deletion porch/pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,9 @@ func (cad *cadEngine) deletePackageRevision(ctx context.Context, repo repository
}
if _, err := cad.metadataStore.Delete(ctx, nn, true); err != nil {
// If this fails, the CR will be cleaned up by the background job.
klog.Warningf("Error deleting PkgRevMeta %s: %v", nn.String(), err)
if !apierrors.IsNotFound(err) {
klog.Warningf("Error deleting PkgRevMeta %s: %v", nn.String(), err)
}
}

sent := cad.watcherManager.NotifyPackageRevisionChange(watch.Deleted, repoPkgRev, pkgRevMeta)
Expand Down

0 comments on commit 0079beb

Please sign in to comment.