Skip to content

Commit

Permalink
improve error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Zen <[email protected]>
  • Loading branch information
desultory committed Oct 1, 2024
1 parent bc3f28f commit 0bf17c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ugrd/crypto/cryptsetup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = 'desultory'
__version__ = '2.5.6'
__version__ = '2.5.7'

from zenlib.util import contains

Expand Down Expand Up @@ -156,7 +156,7 @@ def _validate_cryptsetup_device(self, mapped_name) -> None:
(mapped_name, token_type, cryptsetup_token, blkid_info[token_type]))
break
else:
raise ValueError("[%s] Unable to validate LUKS source: %s" % (mapped_name, cryptsetup_info))
raise ValueError("[%s] No UUID or PARTUUID set for LUKS source: %s" % (mapped_name, cryptsetup_info))

try:
# Get the luks header info, remove tabs, and split the output
Expand All @@ -166,7 +166,8 @@ def _validate_cryptsetup_device(self, mapped_name) -> None:
except RuntimeError as e:
luks_info = []
if not cryptsetup_info.get('header_file'):
return self.logger.error("[%s] Unable to get LUKS information: %s" % (mapped_name, e))
return self.logger.error("[%s] Unable to read LUKS header: %s" % (mapped_name, e))
self.logger.warning("[%s] Cannot read detached LUKS header for validation: %s" % (mapped_name, e))

if token_type == 'uuid': # Validate the LUKS UUID
for line in luks_info:
Expand Down

0 comments on commit 0bf17c6

Please sign in to comment.