inline all messages

This commit is contained in:
timeshifter
2022-12-06 15:15:43 +01:00
parent 28963c3e64
commit 530a1e090a
6 changed files with 13 additions and 30 deletions
+4 -5
View File
@@ -3,7 +3,6 @@ from __future__ import annotations
from pathlib import Path
from ._core import CommandInterface
from ..messages import MAPPER_ENTRY_ALREADY_EXISTS, CANNOT_FIND_DEVICE_PATH
from ..misc import MAPPER_PATH, DISK_BY_UUID
@@ -31,8 +30,7 @@ class Cryptsetup(CommandInterface):
if cls._mapper_entry_in_use(mapper_entry):
if cls._already_decrypted(path, mapper_entry):
return True
print(MAPPER_ENTRY_ALREADY_EXISTS)
raise FileExistsError()
raise FileExistsError("mapper entry already exists")
cls._run_command(cls._Subcommands.open, str(path), mapper_entry)
return False
@@ -71,8 +69,9 @@ class Cryptsetup(CommandInterface):
device = Path(line.split(":")[-1].strip())
break
else:
raise FileNotFoundError(CANNOT_FIND_DEVICE_PATH)
# noinspection PyUnboundLocalVariable
raise FileNotFoundError(
"Cannot find device path from output of `cryptsetup status`"
)
return device
@classmethod