From 464ed06dbba37c551c93cae19c81660e8f9a28f0 Mon Sep 17 00:00:00 2001 From: timeshifter Date: Fri, 3 Dec 2021 20:13:01 +0100 Subject: [PATCH] refactor: Cryptsetup subcommands --- zfs-backup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zfs-backup.py b/zfs-backup.py index 89f2a83..5d1f4e2 100755 --- a/zfs-backup.py +++ b/zfs-backup.py @@ -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