diff --git a/pkg/audit/manager.go b/pkg/audit/manager.go index b5e01818839..4ad8bc7a86a 100644 --- a/pkg/audit/manager.go +++ b/pkg/audit/manager.go @@ -488,18 +488,18 @@ func (am *Manager) reviewObjects(ctx context.Context, kind string, folderCount i files, err := am.getFilesFromDir(pDir, int(*auditChunkSize)) if err != nil { - errs = append(errs, err) + am.log.Error(err, "Unable to get files from directory") continue } for _, fileName := range files { contents, err := os.ReadFile(path.Join(pDir, fileName)) // #nosec G304 if err != nil { - errs = append(errs, err) + am.log.Error(err, "Unable to get content from file", "fileName", fileName) continue } objFile, err := am.readUnstructured(contents) if err != nil { - errs = append(errs, err) + am.log.Error(err, "Unable to get unstructured data from content in file", "fileName", fileName) continue } objNs := objFile.GetNamespace() @@ -507,7 +507,6 @@ func (am *Manager) reviewObjects(ctx context.Context, kind string, folderCount i if objNs != "" { ns, err = nsCache.Get(ctx, am.client, objNs) if err != nil { - errs = append(errs, err) am.log.Error(err, "Unable to look up object namespace", "objNs", objNs) continue } @@ -518,7 +517,7 @@ func (am *Manager) reviewObjects(ctx context.Context, kind string, folderCount i } resp, err := am.opa.Review(ctx, augmentedObj) if err != nil { - errs = append(errs, err) + am.log.Error(err, "Unable to review object from file", "fileName", fileName, "objNs", objNs) continue }