Allow to disable mail backup
This commit is contained in:
@@ -24,7 +24,7 @@ def install(appname, config, upgrade):
|
||||
utils.printcolor(u"{}".format(inst), utils.RED)
|
||||
sys.exit(1)
|
||||
|
||||
def backup(config, bashArg):
|
||||
def backup(config, bashArg, nomail):
|
||||
"""Backup instance"""
|
||||
try:
|
||||
script = importlib.import_module(
|
||||
@@ -32,7 +32,7 @@ def backup(config, bashArg):
|
||||
except ImportError:
|
||||
print("Error importing backup")
|
||||
try:
|
||||
getattr(script, "Backup")(config, bashArg).run()
|
||||
getattr(script, "Backup")(config, bashArg, nomail).run()
|
||||
except utils.FatalError as inst:
|
||||
utils.printcolor(u"{}".format(inst), utils.RED)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -28,11 +28,11 @@ class Backup():
|
||||
#||--> mails
|
||||
# |--> vmails
|
||||
|
||||
def __init__(self, config, bashArg):
|
||||
def __init__(self, config, bashArg, nomail):
|
||||
self.config = config
|
||||
self.destinationPath = ""
|
||||
self.BACKUPDIRECTORY = ["mails/", "custom/", "databases/"]
|
||||
|
||||
self.nomail = nomail
|
||||
self.isBash = False
|
||||
self.bash = ""
|
||||
if bashArg != "NOBASH":
|
||||
@@ -113,6 +113,10 @@ class Backup():
|
||||
|
||||
def backupMails(self):
|
||||
|
||||
if self.nomail:
|
||||
utils.printcolor("Skipping mail backup, no-mail argument provided", utils.MAGENTA)
|
||||
return
|
||||
|
||||
utils.printcolor("Backing up mails", utils.MAGENTA)
|
||||
|
||||
home_path = self.config.get("dovecot", "home_dir")
|
||||
|
||||
Reference in New Issue
Block a user