Skip to content

Commit

Permalink
fix: handle resource has no permission error (#344)
Browse files Browse the repository at this point in the history
* fix: handle resource has no premission error

Signed-off-by: chenk <hen.keinan@gmail.com>

* fix: handle resource has no premission error

Signed-off-by: chenk <hen.keinan@gmail.com>

---------

Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan authored May 16, 2024
1 parent ed129a4 commit 4c5a4aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/trivyk8s/trivyk8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ func (c *client) ListArtifacts(ctx context.Context) ([]*artifacts.Artifact, erro
if err != nil {
lerr := fmt.Errorf("failed listing resources for gvr: %v - %w", gvr, err)

if errors.IsNotFound(err) {
if errors.IsNotFound(err) || errors.IsForbidden(err) {
slog.Error("Unable to list resources", "error", lerr)
// if a resource is not found, we log and continue
continue
}

Expand Down

0 comments on commit 4c5a4aa

Please sign in to comment.