refactor: Cryptsetup subcommands
This commit is contained in:
+6
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user