mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
ikiwiki: Re-run setup for each site after restore
Closes: #2028. Tests: - Backup and restore with no sites. - Backup and restore with one wiki and one blog. Confirm that login works for both sites. - Backup from one container, and restore in another container. Confirm that login works for both sites. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
9cec959cd1
commit
a179dd302e
@ -74,8 +74,8 @@ class IkiwikiApp(app_module.App):
|
||||
groups=groups)
|
||||
self.add(users_and_groups)
|
||||
|
||||
backup_restore = BackupRestore('backup-restore-ikiwiki',
|
||||
**manifest.backup)
|
||||
backup_restore = IkiwikiBackupRestore('backup-restore-ikiwiki',
|
||||
**manifest.backup)
|
||||
self.add(backup_restore)
|
||||
|
||||
def post_init(self):
|
||||
@ -111,3 +111,14 @@ class IkiwikiApp(app_module.App):
|
||||
super().setup(old_version)
|
||||
privileged.setup()
|
||||
self.enable()
|
||||
|
||||
|
||||
class IkiwikiBackupRestore(BackupRestore):
|
||||
"""Component to handle Ikiwiki restore"""
|
||||
|
||||
def restore_post(self, packet):
|
||||
"""Re-run setup for each wiki after restore."""
|
||||
super().restore_post(packet)
|
||||
sites = privileged.get_sites()
|
||||
for site in sites:
|
||||
privileged.setup_site(site[0])
|
||||
|
||||
@ -78,6 +78,13 @@ def create_blog(blog_name: str, admin_name: str, admin_password: str):
|
||||
PERL_UNICODE='AS'))
|
||||
|
||||
|
||||
@privileged
|
||||
def setup_site(site_name: str):
|
||||
"""Run setup for a site."""
|
||||
setup_path = os.path.join(WIKI_PATH, site_name + '.setup')
|
||||
subprocess.run(['ikiwiki', '-setup', setup_path], check=True)
|
||||
|
||||
|
||||
@privileged
|
||||
def delete(name: str):
|
||||
"""Delete a wiki or blog."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user