backups: Use the backup component in all apps

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2021-01-04 13:47:38 +02:00
1 parent f630fb6059
commit fb1898befc
105 files changed
+748 -644

No files matched your search

+16 -8
View File
@@ -13,12 +13,13 @@ from plinth import app as app_module
from plinth import frontpage, menu
from plinth.errors import ActionError
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.modules.users.components import UsersAndGroups
from . import manifest
from .forms import is_repo_url
from .manifest import ( # noqa, pylint: disable=unused-import
GIT_REPO_PATH, backup, clients)
from .manifest import GIT_REPO_PATH
version = 1
@@ -56,7 +57,7 @@ class GitwebApp(app_module.App):
name=_('Gitweb'), icon_filename='gitweb',
short_description=_('Simple Git Hosting'),
description=_description, manual_page='GitWeb',
clients=clients)
clients=manifest.clients)
self.add(info)
menu_item = menu.Menu('menu-gitweb', info.name, info.short_description,
@@ -88,6 +89,10 @@ class GitwebApp(app_module.App):
groups=groups)
self.add(users_and_groups)
backup_restore = GitwebBackupRestore('backup-restore-gitweb',
**manifest.backup)
self.add(backup_restore)
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
self.update_service_access()
@@ -140,6 +145,14 @@ class GitwebWebserverAuth(Webserver):
super().enable()
class GitwebBackupRestore(BackupRestore):
"""Component to handle backup/restore for Gitweb."""
def restore_post(self, packet):
"""Update access after restoration of backups."""
app.update_service_access()
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(managed_packages)
@@ -147,11 +160,6 @@ def setup(helper, old_version=None):
helper.call('post', app.enable)
def restore_post(packet):
"""Update access after restoration of backups."""
app.update_service_access()
def repo_exists(name):
"""Check whether a remote repository exists."""
try: