cleanup: return error type in GetCryptoPassphrase()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-12-08 15:17:46 +01:00 committed by mergify[bot]
parent c8c8176a37
commit 3dfe65d17c

View File

@ -150,11 +150,11 @@ func GetCryptoPassphrase(ctx context.Context, volumeID string, kms EncryptionKMS
volumeID) volumeID)
passphrase, err = generateNewEncryptionPassphrase() passphrase, err = generateNewEncryptionPassphrase()
if err != nil { if err != nil {
return "", fmt.Errorf("failed to generate passphrase for %s: %s", volumeID, err) return "", fmt.Errorf("failed to generate passphrase for %s: %w", volumeID, err)
} }
err = kms.SavePassphrase(volumeID, passphrase) err = kms.SavePassphrase(volumeID, passphrase)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to save the passphrase for %s: %s", volumeID, err) return "", fmt.Errorf("failed to save the passphrase for %s: %w", volumeID, err)
} }
return passphrase, nil return passphrase, nil
} }