more refactoring

This commit is contained in:
Spitap
2022-09-19 15:13:44 +02:00
parent f3811b4b39
commit d75d83f202
7 changed files with 44 additions and 50 deletions

View File

@@ -42,12 +42,13 @@ class Amavis(base.Installer):
def get_config_files(self):
"""Return appropriate config files."""
if package.backend.FORMAT == "deb":
amavisCustomConf = os.path.join(self.restore, "custom/99-custom")
if self.restore and os.path.isfile(amavisCustomConf):
utils.copy_file(amavisCustomConf, os.path.join(
amavis_custom_configuration = os.path.join(
self.restore, "custom/99-custom")
if self.restore and os.path.isfile(amavis_custom_configuration):
utils.copy_file(amavis_custom_configuration, os.path.join(
self.config_dir, "/conf.d"))
utils.printcolor(
"Custom amavis configuration restored", utils.GREEN)
"Custom amavis configuration restored.", utils.GREEN)
return [
"conf.d/05-node_id", "conf.d/15-content_filter_mode",
"conf.d/50-user"]
@@ -77,7 +78,7 @@ class Amavis(base.Installer):
"""Return schema path."""
if self.restore:
utils.printcolor(
"Trying to restore amavis database from backup", utils.MAGENTA)
"Trying to restore amavis database from backup.", utils.MAGENTA)
amavis_db_backup_path = os.path.join(
self.restore, "databases/amavis.sql")
if os.path.isfile(amavis_db_backup_path):
@@ -85,7 +86,7 @@ class Amavis(base.Installer):
"Amavis database backup found ! Restoring...", utils.GREEN)
return amavis_db_backup_path
utils.printcolor(
"Amavis database backup not found, creating empty database", utils.RED)
"Amavis database backup not found, creating empty database.", utils.RED)
version = package.backend.get_installed_version("amavisd-new")
if version is None: