From fe9ee9777453547a090e08f2afa8761ba84e092d Mon Sep 17 00:00:00 2001 From: kload Date: Sun, 26 Oct 2014 01:05:18 +0200 Subject: [PATCH] [enh] Warn user about unbackup/unrestored apps --- backup.py | 13 +++++++++++-- locales/en.json | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backup.py b/backup.py index fc1c21590..2a650574e 100644 --- a/backup.py +++ b/backup.py @@ -53,8 +53,12 @@ def backup_backup(): try: for app_id in os.listdir('/etc/yunohost/apps'): hook = '/etc/yunohost/apps/'+ app_id +'/scripts/backup' - with open(hook, 'r') as f: + if os.path.isfile(hook): hook_add(app_id, hook) + else: + msignals.display(m18n.n('unbackup_app', app_id), + 'warning') + except IOError: pass @@ -91,6 +95,8 @@ def backup_restore(path): try: with open('/etc/yunohost/installed') as f: #raise MoulinetteError(errno.EINVAL, m18n.n('yunohost_already_installed')) + msignals.display(m18n.n('restoring_installed_system'), 'warning') + time.sleep(5) pass except IOError: tools_postinstall(domain, 'yunohost', True) @@ -99,8 +105,11 @@ def backup_restore(path): try: for app_id in os.listdir('/etc/yunohost/apps'): hook = '/etc/yunohost/apps/'+ app_id +'/scripts/restore' - with open(hook, 'r') as f: + if os.path.isfile(hook): hook_add(app_id, hook) + else: + msignals.display(m18n.n('unrestore_app', app_id), + 'warning') except IOError: pass diff --git a/locales/en.json b/locales/en.json index 09d42bdd8..2f5d4597d 100644 --- a/locales/en.json +++ b/locales/en.json @@ -131,6 +131,9 @@ "backup_complete" : "Backup complete", "invalid_restore_package" : "Invalid restore package", "restore_complete" : "Restore complete", + "restoring_installed_system" : "You are trying to restore a backup on an already installed system, abort unless you know what you are doing!", + "unbackup_app" : "'{:s}' will NOT be saved", + "unrestore_app" : "'{:s}' will NOT be restored", "field_invalid" : "Invalid field '{:s}'", "mail_domain_unknown" : "Unknown mail address domain '{:s}'",