Skip to content

Commit d62dac2

Browse files
committed
improve error handling
Signed-off-by: Zen <[email protected]>
1 parent 6c4ec0f commit d62dac2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ugrd/fs/mounts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ def autodetect_root_luks(self, mount_loc, mapped_name, luks_mount) -> None:
291291
self.logger.debug("[%s] LUKS mount info: %s" % (mapped_name, luks_mount))
292292
if luks_mount.get('type') != 'crypto_LUKS':
293293
if not luks_mount.get('uuid'): # No uuid will be defined if there are detached headers
294-
self.logger.error("[%s] Unknown device mapper slave type: %s" % (self._dm_info[mapped_name]['slaves'][0], luks_mount.get('type')))
294+
if self['cryptsetup'][self._dm_info[mapped_name]['name']].get('header_fiile'):
295+
raise ValueError("[%s] Unknown LUKS mount type, if using detached headers, specify 'header_file': %s" % (mount_loc.name, luks_mount.get('type')))
295296
else: # If there is some uuid and it's not LUKS, that's a problem
296297
raise RuntimeError("[%s] Unknown device mapper slave type: %s" % (self._dm_info[mapped_name]['slaves'][0], luks_mount.get('type')))
297298

0 commit comments

Comments
 (0)