From 0079bebaed57e0dab54268ec8116c3cd18cd89ef Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Wed, 11 Oct 2023 20:09:22 +0000 Subject: [PATCH] Suppress NotFound error logging on delete calls (#4057) Signed-off-by: Morten Torkildsen --- porch/pkg/cache/repository.go | 4 +++- porch/pkg/engine/engine.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/porch/pkg/cache/repository.go b/porch/pkg/cache/repository.go index bd387b792..4e10170ff 100644 --- a/porch/pkg/cache/repository.go +++ b/porch/pkg/cache/repository.go @@ -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, diff --git a/porch/pkg/engine/engine.go b/porch/pkg/engine/engine.go index a7fbc724e..1aeec8d44 100644 --- a/porch/pkg/engine/engine.go +++ b/porch/pkg/engine/engine.go @@ -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)