Add components for daemon, firewall and uwsgi
Rationale
- The merge request further creates more components. Due to the maturity achieved with new components a lot of repeated code can now be eliminated. These changes now bring out the true intent of the components architecture and make it straight forward to identify further components (such as UserGroup instead of register_group(), perhaps DiagnosticTest, BackupRestore, ClientsInfo, etc.) and also further improvements (such as automatic building of components using declarative data in manifest, automatic init(), turning SetupHelper() into component or merging it with App() etc.).
- Currently the plinth/service.py:Service() is being used to represent multiple unrelated concepts. It is used for systemd units, firewall ports and for running state of an app. This is confusing. It also leads to strange code such as creating Service() objects when there are no daemons or when there are no firewall ports. Multiple service objects are also necessary for multiple firewall port sets but daemons for both are the same. This class also incorrectly assumes control of the entire app's entire enable/disable flow leading to necessary callbacks and their setup. Proposed changes split this class into smaller and simpler components that are easier to understand.
Major changes
- Introduce component for firewall port management, separate out from the confusing 'service' concept.
- Introduce component for managing uWSGI configuration.
- Introduce component for managing systemd units. Call it 'daemon' for clarifying the mixed up and confusing term 'service'.
- Remove is_running(), is_enabled(), enable() and disable() methods from app implementation. They are mostly just repeated code.
- Remove enable/disable methods from action scripts in favour of using common scripts.
- Rename ServiceForm to AppForm to resolve confusion around the term 'service'. Accordingly rename service*.html to app*.html.
- Fix issue with starting radicale uwsgi service due to log directory not existing.
- Automatically running yapf and isort when saving files.
- Regression: Tor enable/disable operation no longer shows as part of operation progress page.
Tests
For each app modified, I have manually tested all of the following:
- Setup app
- App is enabled
- Special setup is done
- App is running
- Restart
- App shows enabled
- Enable
- App is running
- uwsgi link present
- webserver config enabled
- service enabled
- firewall port opened
- firewall page shows information
- Disable
- App is not running
- uwsgi link removed
- webserver config disabled
- service disabled
- firewall port disabled
- firewall page shows information
- Login and logout works
- Setting home page works
- Run diagnostics
- Software updates is enabled/disabled.
- Could not test radicale with radicale package version < 2.0
- Could not test disabled apps