refactor: Cryptsetup subcommands
This commit is contained in:
+6
-3
@@ -416,11 +416,13 @@ class Cryptsetup:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def encrypt(cls, mapper_entry: str) -> None:
|
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
|
@classmethod
|
||||||
def _status(cls, name: str) -> str:
|
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
|
@classmethod
|
||||||
def decrypt(cls, path: Path, mapper_entry: str) -> bool:
|
def decrypt(cls, path: Path, mapper_entry: str) -> bool:
|
||||||
@@ -429,7 +431,8 @@ class Cryptsetup:
|
|||||||
return True
|
return True
|
||||||
print(MAPPER_ENTRY_ALREADY_EXISTS)
|
print(MAPPER_ENTRY_ALREADY_EXISTS)
|
||||||
exit(EXIT_ERROR)
|
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
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user