Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/audit/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,26 +488,25 @@ 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()
ns := corev1.Namespace{}
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
}
Expand All @@ -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
}

Expand Down