refactor: exit code constants
This commit is contained in:
+5
-4
@@ -13,6 +13,8 @@ from uuid import UUID
|
||||
|
||||
import config
|
||||
|
||||
EXIT_ERROR = 1
|
||||
|
||||
ALREADY_DECRYPTED = "Cannot decrypt, already decrypted"
|
||||
ALREADY_IMPORTED = "Cannot import, already imported"
|
||||
CANNOT_FIND_BACKUP_DRIVE = "Could not find a backup drive"
|
||||
@@ -322,8 +324,7 @@ class Disk:
|
||||
for item in MAPPER_PATH.iterdir():
|
||||
if self._mapper_entry == item.name:
|
||||
print(MAPPER_ENTRY_ALREADY_EXISTS, self._mapper_entry)
|
||||
# TODO exit code constants
|
||||
exit(1)
|
||||
exit(EXIT_ERROR)
|
||||
|
||||
@property
|
||||
def _path(self) -> Path:
|
||||
@@ -394,7 +395,7 @@ class ExternalPool(Pool):
|
||||
return cls(pool_name, disk)
|
||||
else:
|
||||
print(CANNOT_FIND_BACKUP_DRIVE)
|
||||
exit(1)
|
||||
exit(EXIT_ERROR)
|
||||
|
||||
def clean_old_snapshots(self):
|
||||
print("Cleaning old snapshots")
|
||||
@@ -501,7 +502,7 @@ class Command:
|
||||
def verify_running_as_root():
|
||||
if getuid() > 0:
|
||||
print(RUN_AS_ROOT)
|
||||
exit(1)
|
||||
exit(EXIT_ERROR)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user