mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
letsencrypt: Handle both standard and custom repairs
Pass remaining failed checks to super. Tests: - Remove /etc/letsencrypt/renewal-hooks/deploy/50-freedombox so that the diagnostic fails. Running repair causes the file to be re-created. - Set domain name to non-existing domain so that the diagnostic fails. Running repair attempts to obtain the certificate. - Have both diagnostics failing. Running repair will attempt to repair both. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
cbfaee85b5
commit
58c7de8d66
@ -104,18 +104,16 @@ class LetsEncryptApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def repair(self, failed_checks: list) -> bool:
|
def repair(self, failed_checks: list) -> bool:
|
||||||
"""Try to repair failed diagnostics.
|
"""Handle repair for custom diagnostic."""
|
||||||
|
|
||||||
Returns whether the app setup should be re-run.
|
|
||||||
"""
|
|
||||||
status = get_status()
|
status = get_status()
|
||||||
|
remaining_checks = []
|
||||||
# Obtain/re-obtain certificates for failing domains
|
for check in failed_checks:
|
||||||
for failed_check in failed_checks:
|
if not check.check_id.startswith('letsencrypt-domain'):
|
||||||
if not failed_check.check_id.startswith('letsencrypt-domain'):
|
remaining_checks.append(check)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
domain = failed_check.parameters['domain']
|
# Obtain/re-obtain certificates for failing domains
|
||||||
|
domain = check.parameters['domain']
|
||||||
try:
|
try:
|
||||||
domain_status = status['domains'][domain]
|
domain_status = status['domains'][domain]
|
||||||
if domain_status.get('certificate_available', False):
|
if domain_status.get('certificate_available', False):
|
||||||
@ -128,7 +126,7 @@ class LetsEncryptApp(app_module.App):
|
|||||||
# Add the error message to thread local storage
|
# Add the error message to thread local storage
|
||||||
store_error_message(str(error))
|
store_error_message(str(error))
|
||||||
|
|
||||||
return False
|
return super().repair(remaining_checks)
|
||||||
|
|
||||||
def setup(self, old_version):
|
def setup(self, old_version):
|
||||||
"""Install and configure the app."""
|
"""Install and configure the app."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user