Merge pull request #24354 from akhilnarang/check-for-gpg-install
fix: add a check for `gpg` existing
This commit is contained in:
commit
7c526bc7cd
1 changed files with 7 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import contextlib
|
|||
# imports - standard imports
|
||||
import gzip
|
||||
import os
|
||||
import sys
|
||||
from calendar import timegm
|
||||
from datetime import datetime
|
||||
from glob import glob
|
||||
|
|
@ -225,6 +226,9 @@ class BackupGenerator:
|
|||
"""
|
||||
Encrypt all the backups created using gpg.
|
||||
"""
|
||||
if which("gpg") is None:
|
||||
click.secho("Please install `gpg` and ensure its available in your PATH", fg="red")
|
||||
sys.exit(1)
|
||||
paths = (self.backup_path_db, self.backup_path_files, self.backup_path_private_files)
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
|
|
@ -640,6 +644,9 @@ def get_or_generate_backup_encryption_key():
|
|||
|
||||
@contextlib.contextmanager
|
||||
def decrypt_backup(file_path: str, passphrase: str):
|
||||
if which("gpg") is None:
|
||||
click.secho("Please install `gpg` and ensure its available in your PATH", fg="red")
|
||||
sys.exit(1)
|
||||
if not os.path.exists(file_path):
|
||||
print("Invalid path: ", file_path)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue