Formating, force outdated config check
This commit is contained in:
@@ -44,8 +44,7 @@ class Backup:
|
||||
path_exists = os.path.exists(path)
|
||||
|
||||
if path_exists and os.path.isfile(path):
|
||||
utils.printcolor(
|
||||
"Error, you provided a file instead of a directory!", utils.RED)
|
||||
utils.error("Error, you provided a file instead of a directory!")
|
||||
return False
|
||||
|
||||
if not path_exists:
|
||||
@@ -58,9 +57,7 @@ class Backup:
|
||||
utils.mkdir_safe(path, stat.S_IRWXU |
|
||||
stat.S_IRWXG, pw[2], pw[3])
|
||||
else:
|
||||
utils.printcolor(
|
||||
"Error, backup directory not present.", utils.RED
|
||||
)
|
||||
utils.error("Error, backup directory not present.")
|
||||
return False
|
||||
|
||||
if len(os.listdir(path)) != 0:
|
||||
@@ -80,9 +77,7 @@ class Backup:
|
||||
shutil.rmtree(os.path.join(path, "databases"),
|
||||
ignore_errors=False)
|
||||
else:
|
||||
utils.printcolor(
|
||||
"Error: backup directory not clean.", utils.RED
|
||||
)
|
||||
utils.error("Error: backup directory not clean.")
|
||||
return False
|
||||
|
||||
self.backup_path = path
|
||||
@@ -131,8 +126,8 @@ class Backup:
|
||||
home_path = self.config.get("dovecot", "home_dir")
|
||||
|
||||
if not os.path.exists(home_path) or os.path.isfile(home_path):
|
||||
utils.printcolor("Error backing up Email, provided path "
|
||||
f" ({home_path}) seems not right...", utils.RED)
|
||||
utils.error("Error backing up Email, provided path "
|
||||
f" ({home_path}) seems not right...")
|
||||
|
||||
else:
|
||||
dst = os.path.join(self.backup_path, "mails/")
|
||||
|
||||
@@ -131,7 +131,7 @@ class Installer(object):
|
||||
return
|
||||
exitcode, output = package.backend.install_many(packages)
|
||||
if exitcode:
|
||||
utils.printcolor("Failed to install dependencies", utils.RED)
|
||||
utils.error("Failed to install dependencies")
|
||||
sys.exit(1)
|
||||
|
||||
def get_config_files(self):
|
||||
|
||||
@@ -13,14 +13,14 @@ class Restore:
|
||||
"""
|
||||
|
||||
if not os.path.isdir(restore):
|
||||
utils.printcolor(
|
||||
"Provided path is not a directory !", utils.RED)
|
||||
utils.error(
|
||||
"Provided path is not a directory !")
|
||||
sys.exit(1)
|
||||
|
||||
modoba_sql_file = os.path.join(restore, "databases/modoboa.sql")
|
||||
if not os.path.isfile(modoba_sql_file):
|
||||
utils.printcolor(
|
||||
modoba_sql_file + " not found, please check your backup", utils.RED)
|
||||
utils.error(
|
||||
modoba_sql_file + " not found, please check your backup")
|
||||
sys.exit(1)
|
||||
|
||||
# Everything seems alright here, proceeding...
|
||||
|
||||
Reference in New Issue
Block a user