Skip to content

Commit

Permalink
Merge pull request #220 from nlamirault/feat/sops-errors
Browse files Browse the repository at this point in the history
Add SOPS user error to logs
  • Loading branch information
stefanprodan authored Dec 17, 2020
2 parents 5efc068 + 460eae2 commit f0a3147
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/kustomization_decryptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os/exec"

securejoin "github.com/cyphar/filepath-securejoin"
"go.mozilla.org/sops/v3"
"go.mozilla.org/sops/v3/aes"
"go.mozilla.org/sops/v3/cmd/sops/common"
"go.mozilla.org/sops/v3/cmd/sops/formats"
Expand Down Expand Up @@ -87,6 +88,9 @@ func (kd *KustomizeDecryptor) Decrypt(res *resource.Resource) (*resource.Resourc
},
)
if err != nil {
if userErr, ok := err.(sops.UserError); ok {
err = fmt.Errorf(userErr.UserError())
}
return nil, fmt.Errorf("GetDataKey: %w", err)
}

Expand Down

0 comments on commit f0a3147

Please sign in to comment.