mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +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,7 +74,7 @@ class IkiwikiApp(app_module.App):
|
|||||||
groups=groups)
|
groups=groups)
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
backup_restore = BackupRestore('backup-restore-ikiwiki',
|
backup_restore = IkiwikiBackupRestore('backup-restore-ikiwiki',
|
||||||
**manifest.backup)
|
**manifest.backup)
|
||||||
self.add(backup_restore)
|
self.add(backup_restore)
|
||||||
|
|
||||||
@ -111,3 +111,14 @@ class IkiwikiApp(app_module.App):
|
|||||||
super().setup(old_version)
|
super().setup(old_version)
|
||||||
privileged.setup()
|
privileged.setup()
|
||||||
self.enable()
|
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'))
|
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
|
@privileged
|
||||||
def delete(name: str):
|
def delete(name: str):
|
||||||
"""Delete a wiki or blog."""
|
"""Delete a wiki or blog."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user