*: Make setup method part of App class for all apps

- Primary purpose is to complete the App API and allow for multiple apps to be
present in a module without a single clashing setup() method. Secondary
objective is to get rid of SetupHelper instance simple use App instance instead.

- This brings us closer to not needing to implement setup() method for some of
the typical apps.

- Remove default value None for old_version parameter.

  - A valid integer value is always passed to this call.

  - The value of None is undefined.

  - Simplifies the App API slightly.

- Drop setting 'pre', 'post' values to indicate the stage of setup for the App.

  - Simplifies the setup methods significantly. Eliminates a class of
  bugs (some of them seen earlier).

  - The UI can show a simple 'installing...' or progress spinner instead of
  individual stages.

  - There are currently many inconsistencies where many operations are not
  wrapped in helper.call() calls.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2022-08-15 10:36:16 -04:00
1 parent cbef3e0163
commit 75f6abac1e
55 files changed
+505 -553

No files matched your search

+6 -7
View File
@@ -128,6 +128,12 @@ class GitwebApp(app_module.App):
self.set_shortcut_login_required(True)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
actions.superuser_run('gitweb', ['setup'])
self.enable()
class GitwebWebserverAuth(Webserver):
"""Component to handle Gitweb authentication webserver configuration."""
@@ -157,13 +163,6 @@ class GitwebBackupRestore(BackupRestore):
app.update_service_access()
def setup(helper, old_version=None):
"""Install and configure the module."""
app.setup(old_version)
helper.call('post', actions.superuser_run, 'gitweb', ['setup'])
helper.call('post', app.enable)
def repo_exists(name):
"""Check whether a remote repository exists."""
try: