refactor: Cryptsetup subcommands

This commit is contained in:
timeshifter
2021-12-03 20:13:01 +01:00
parent fef8a3f3ea
commit 464ed06dbb
+6 -3
View File
@@ -416,11 +416,13 @@ class Cryptsetup:
@classmethod
def encrypt(cls, mapper_entry: str) -> None:
CommandRunner.run([cls._CRYPTSETUP, "close", mapper_entry])
command = [cls._CRYPTSETUP, cls._Subcommands.close, mapper_entry]
CommandRunner.run(command)
@classmethod
def _status(cls, name: str) -> str:
return CommandRunner.get_output([cls._CRYPTSETUP, "status", name])
command = [cls._CRYPTSETUP, cls._Subcommands.status, name]
return CommandRunner.get_output(command)
@classmethod
def decrypt(cls, path: Path, mapper_entry: str) -> bool:
@@ -429,7 +431,8 @@ class Cryptsetup:
return True
print(MAPPER_ENTRY_ALREADY_EXISTS)
exit(EXIT_ERROR)
CommandRunner.run([cls._CRYPTSETUP, "open", str(path), mapper_entry])
command = [cls._CRYPTSETUP, cls._Subcommands.open, str(path), mapper_entry]
CommandRunner.run(command)
return False
@classmethod