Add app repair for diagnostic failures/warnings
Helps #2399 (closed).
- diagnostics: Add optional component_id to DiagnosticCheck
- app, component: Add repair method
- Allows apps and component to implement custom repair methods.
- Default implementation asks relevant components to repair, and then if needed, requests re-run setup for the app.
- Component.repair will return True by default, indicating that setup should be re-run.
- setup: Add method to run app repair
- Repair is run within an operation.
- Diagnostics are run for the app first.
- Call app.repair, then re-run setup if needed.
- Add helper functions for apps or components to store error messages in thread local storage. These error messages are shown at the end.
- diagnostics: Change "Re-run setup" to "Try to repair"
- letsencrypt: Re-obtain certificates during repair
- Set check_id and domain for domain diagnostic check
- In case of failing domain, try to re-obtain the certificate.
- If there is an error, store it in thread local storage.
- Any other failing diagnostic checks are handled by default implementation.
- letsencrypt: Fix diagnostic warning when no names configured
Tests:
-
Run repair for warnings due to new package version available. Repair is completed successfully.
-
Set an invalid domain name, and run repair for Let's Encrypt. Repair is completed and error is shown.
Signed-off-by: James Valleroy jvalleroy@mailbox.org
Edited by James Valleroy