From b370d9afb6d1fc226bbf5ad34f5a77b9d2c2590d Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 3 Feb 2021 16:49:03 +0530 Subject: [PATCH] rbd: unmarshal the data read from file if are reading the kms data from the file. than only we need to unmarshal. If we are reading from the configmap it already returns the unmarshal data. Signed-off-by: Madhu Rajanna --- internal/util/crypto.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/util/crypto.go b/internal/util/crypto.go index 44d3c1195..f98d2ff96 100644 --- a/internal/util/crypto.go +++ b/internal/util/crypto.go @@ -145,11 +145,11 @@ func GetKMS(tenant, kmsID string, secrets map[string]string) (EncryptionKMS, err return nil, fmt.Errorf("failed to read kms configuration from configmap %s in namespace %s: %w", namespace, name, err) } - } - - err = json.Unmarshal(content, &config) - if err != nil { - return nil, fmt.Errorf("failed to parse kms configuration: %w", err) + } else { + err = json.Unmarshal(content, &config) + if err != nil { + return nil, fmt.Errorf("failed to parse kms configuration: %w", err) + } } kmsConfig, ok := config[kmsID].(map[string]interface{})