diff --git a/actions/backups b/actions/backups index 2e2d940c3..36a348b93 100755 --- a/actions/backups +++ b/actions/backups @@ -41,8 +41,8 @@ def parse_arguments(): create = subparsers.add_parser('create', help='Create archive') create.add_argument('--name', help='Archive name', required=True) - create.add_argument( - '--path', help='Paths to include in archive', nargs='+') + create.add_argument('--paths', help='Paths to include in archive', + nargs='+') delete = subparsers.add_parser('delete', help='Delete archive') delete.add_argument('--name', help='Archive name', required=True) @@ -90,9 +90,13 @@ def subcommand_list(_): def subcommand_create(arguments): """Create archive.""" + paths = filter(os.path.exists, arguments.paths) subprocess.run([ - 'borg', 'create', '--json', REPOSITORY + '::' + arguments.name, - ] + arguments.path, check=True) + 'borg', + 'create', + '--json', + REPOSITORY + '::' + arguments.name, + ] + list(paths), check=True) def subcommand_delete(arguments): diff --git a/plinth/modules/backups/__init__.py b/plinth/modules/backups/__init__.py index 2a9147bd0..db7095de9 100644 --- a/plinth/modules/backups/__init__.py +++ b/plinth/modules/backups/__init__.py @@ -23,18 +23,21 @@ import os from django.utils.translation import ugettext_lazy as _ -from .backups import backup_apps from plinth import actions from plinth.menu import main_menu from plinth.modules import udiskie +from .backups import backup_apps + version = 1 managed_packages = ['borgbackup'] name = _('Backups') -description = [_('Backups allows creating and managing backup archives.'), ] +description = [ + _('Backups allows creating and managing backup archives.'), +] service = None @@ -87,8 +90,8 @@ def _backup_handler(packet): paths = packet.directories + packet.files paths.append(manifest_path) - actions.superuser_run('backups', - ['create', '--name', packet.label, '--path'] + paths) + actions.superuser_run( + 'backups', ['create', '--name', packet.label, '--paths'] + paths) def create_archive(name, app_names):