From 151d06693884a04394cbfd6fc1709229a9fe67b0 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 1 Apr 2021 16:28:47 +0200 Subject: [PATCH] util: add logging when OpenEncryptedVolume() encounters an error Signed-off-by: Niels de Vos --- internal/util/crypto.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/util/crypto.go b/internal/util/crypto.go index 7658d5a2c..452cb1494 100644 --- a/internal/util/crypto.go +++ b/internal/util/crypto.go @@ -243,7 +243,10 @@ func EncryptVolume(ctx context.Context, devicePath, passphrase string) error { // OpenEncryptedVolume opens volume so that it can be used by the client. func OpenEncryptedVolume(ctx context.Context, devicePath, mapperFile, passphrase string) error { DebugLog(ctx, "Opening device %s with LUKS on %s", devicePath, mapperFile) - _, _, err := LuksOpen(devicePath, mapperFile, passphrase) + _, stderr, err := LuksOpen(devicePath, mapperFile, passphrase) + if err != nil { + WarningLog(ctx, "failed to open LUKS device %q: %s", devicePath, stderr) + } return err }