Add a global setting to still compress tar archives

This commit is contained in:
Alexandre Aubin 2020-08-31 19:08:43 +02:00
parent 7ccc7fa13e
commit 839a7b9a47
2 changed files with 6 additions and 5 deletions

View file

@ -53,6 +53,7 @@ from yunohost.regenconf import regen_conf
from yunohost.log import OperationLogger
from yunohost.utils.error import YunohostError
from yunohost.utils.packages import ynh_packages_version
from yunohost.settings import settings_get
BACKUP_PATH = '/home/yunohost.backup'
ARCHIVES_PATH = '%s/archives' % BACKUP_PATH
@ -1772,15 +1773,14 @@ class CopyBackupMethod(BackupMethod):
class TarBackupMethod(BackupMethod):
"""
This class compress all files to backup in archive.
"""
method_name = "tar"
@property
def _archive_file(self):
"""Return the compress archive path"""
if isinstance(self.manager, BackupManager) and settings_get("backup.compress_tar_archives"):
return os.path.join(self.repo, self.name + '.tar.gz')
f = os.path.join(self.repo, self.name + '.tar')
if os.path.exists(f + ".gz"):
f += ".gz"

View file

@ -71,6 +71,7 @@ DEFAULTS = OrderedDict([
"choices": ["intermediate", "modern"]}),
("pop3.enabled", {"type": "bool", "default": False}),
("smtp.allow_ipv6", {"type": "bool", "default": True}),
("backup.compress_tar_archives", {"type": "bool", "default": False}),
])