Skip to content

Commit

Permalink
decryptor: mention Secret name in import errors
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <hello@hidde.co>
  • Loading branch information
hiddeco committed Apr 5, 2022
1 parent eb27227 commit 73aead4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/kustomization_decryptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ func (kd *KustomizeDecryptor) ImportKeys(ctx context.Context) error {
switch filepath.Ext(name) {
case ".asc":
if err = kd.gnuPGHome.Import(value); err != nil {
return fmt.Errorf("failed to import '%s' Secret data: %w", name, err)
return fmt.Errorf("failed to import '%s' data from Secret '%s': %w", name, secretName, err)
}
case ".agekey":
if err = kd.ageIdentities.Import(string(value)); err != nil {
return fmt.Errorf("failed to import '%s' Secret data: %w", name, err)
return fmt.Errorf("failed to import '%s' data from Secret '%s': %w", name, secretName, err)
}
case filepath.Ext(DecryptionVaultTokenFileName):
// Make sure we have the absolute name
Expand All @@ -174,10 +174,10 @@ func (kd *KustomizeDecryptor) ImportKeys(ctx context.Context) error {
if name == DecryptionAzureAuthFile {
conf := azkv.AADConfig{}
if err = azkv.LoadAADConfigFromBytes(value, &conf); err != nil {
return fmt.Errorf("failed to import '%s' Secret data: %w", name, err)
return fmt.Errorf("failed to import '%s' data from Secret '%s': %w", name, secretName, err)
}
if kd.azureToken, err = azkv.TokenFromAADConfig(conf); err != nil {
return fmt.Errorf("failed to import '%s' Secret data: %w", name, err)
return fmt.Errorf("failed to import '%s' data from Secret '%s': %w", name, secretName, err)
}
}
}
Expand Down

0 comments on commit 73aead4

Please sign in to comment.