From 73aead44b4fd8bb967419b7e585b2758d3e91085 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 5 Apr 2022 00:03:16 +0200 Subject: [PATCH] decryptor: mention Secret name in import errors Signed-off-by: Hidde Beydals --- controllers/kustomization_decryptor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/kustomization_decryptor.go b/controllers/kustomization_decryptor.go index ae4a164b9..6a10a401b 100644 --- a/controllers/kustomization_decryptor.go +++ b/controllers/kustomization_decryptor.go @@ -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 @@ -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) } } }