9 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
b5c641097a
zoph: Re-add a safety check when reading the setup state of the app
- Similar check was removed in 6646512a0adab6943503ec47372502fb28805911 when it
was that it was not needed.

Tests:

- Run functional tests for zoph.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-31 20:48:00 -04:00
Sunil Mohan Adapa
7d4c5650f4
zoph: Restore database password to old value after restore op.
Fixes: #2346.

Tests:

- Without the patch, install zoph, take a backup. Note the db password in
/etc/zoph.ini. Uninstall zoph. Install it. Note that db password changed.
Restore from previous backup. Note that password has been restored to old value
and zoph is unable to connect to database.

- With the patch, repeat the test and notice zoph works after restore.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:49 -04:00
Sunil Mohan Adapa
74fc8e08da
zoph: Uninstall fully so that reinstall works
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:35 -04:00
Sunil Mohan Adapa
17e84419b8
zoph: Don't fail with backup/restore if app is disabled
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:32 -04:00
Sunil Mohan Adapa
6646512a0a
zoph: Don't redirect to setup page when app is disabled
- When app is disabled, it can't be setup as it requires database server and
connecting to the database.

- If app is disabled, we don't show configuration any more, so redirection to
setup page is also not needed. This results in neither setup nor configuration
being shown when app is disabled.

- During uninstall process, app is disable for first. So, the workaround
implemented in is_configured() is no longer needed.

Tests:

- Install zoph. Setup page is shown. Disable the app by disabling the apache
configuration for it and restart service. Setup is no longer shown.

- Uninstall zoph. During the uninstall setup, when page is refreshing, setup
page is not shown.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:21 -04:00
Sunil Mohan Adapa
d79ba1cede
zoph: Don't fail setup if mysql installed but not running
Tests:

- Install wordpress and disable it. This will install mysql and disable it. Then
install zoph installation should succeed.

- Disable zoph and re-run setup. Setup should succeed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-11 16:50:09 -04:00
Sunil Mohan Adapa
38ece87c6c
*: Utilize newer 3.10 syntax for type hints
Tests:

- mypy does not show any errors.

- Installing ejabberd app works. Privileged actions run fine.

- Unit tests work.

- No additional testing was done as type annotations don't have any effect at
runtime.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-09-25 20:03:34 -04:00
Sunil Mohan Adapa
f30c028289
zoph: Don't fail at showing app view during uninstall
During uninstall step, zoph command may not be available and is_configured() may
error out. In such cases, let the base class AppView show the operations view.

Tests:

- Introduce a sleep in overridden uninstall() method for zoph. Notice that there
is an error showing the view during uninstall. Apply patch and the error is no
longer shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-05-07 10:46:23 -04:00
Sunil Mohan Adapa
7f8eebce4c
zoph: Use privileged decorator for actions
Tests:

- Functional tests work
  - Dump/restore of database works
- Initial setup works
  - MySQL Database is created
  - Configuration options are set
  - OSM is enabled by default
  - User who installed the app becomes admin
- Setting configuration works
  - Enabling OSM
  - Setting admin user

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:41 -04:00