fix: Folder creation failures, click.(s)echo

This commit is contained in:
Gavin D'souza 2020-09-25 14:07:14 +05:30
parent 5361464468
commit a098cd0055
2 changed files with 3 additions and 4 deletions

View file

@ -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:

View file

@ -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: