From a098cd0055cd36137cf44f61cf6f82e1ad8b693f Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 25 Sep 2020 14:07:14 +0530 Subject: [PATCH] fix: Folder creation failures, click.(s)echo --- frappe/commands/site.py | 4 ++-- frappe/utils/backups.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frappe/commands/site.py b/frappe/commands/site.py index efdfb5465c..d72b7429a6 100755 --- a/frappe/commands/site.py +++ b/frappe/commands/site.py @@ -405,7 +405,7 @@ def backup(context, with_files=False, backup_path=None, backup_path_db=None, bac frappe.connect() odb = scheduled_backup(ignore_files=not with_files, backup_path=backup_path, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, backup_path_conf=backup_path_conf, force=True, verbose=verbose, compress=compress) except Exception: - click.echo("Backup failed for Site {0}. Database or site_config.json may be corrupted".format(site), fg="red") + click.secho("Backup failed for Site {0}. Database or site_config.json may be corrupted".format(site), fg="red") exit_code = 1 continue @@ -417,7 +417,7 @@ def backup(context, with_files=False, backup_path=None, backup_path_db=None, bac if with_files: print("Public file: {0}\nPrivate file: {1}".format(odb.backup_path_files, odb.backup_path_private_files)) - click.echo("Backup for Site {0} has been successfully completed{1}".format(site, " with files" if with_files else ""), fg="green") + click.secho("Backup for Site {0} has been successfully completed{1}".format(site, " with files" if with_files else ""), fg="green") frappe.destroy() if not context.sites: diff --git a/frappe/utils/backups.py b/frappe/utils/backups.py index 54ff11ff03..4b5430f0bd 100644 --- a/frappe/utils/backups.py +++ b/frappe/utils/backups.py @@ -68,8 +68,7 @@ class BackupGenerator: os.makedirs(backups_folder) else: if self.backup_path: - dir = os.path.dirname(self.backup_path) - os.makedirs(dir, exist_ok=True) + os.makedirs(self.backup_path, exist_ok=True) for file_path in set([self.backup_path_files, self.backup_path_db, self.backup_path_private_files, self.backup_path_conf]): if file_path: