letsencrypt: Remove unnecessary processing of the error messages

- This allows the certbot command output to be shown accurately in the HTML
error message.

Tests:

- Edit the code to show all the action buttons in the UI. Set domain to
mydomain.example. Run all four actions. Notice that HTML error message are shown
and certbot output is shown properly in stdout/stderr sections.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-03-18 15:40:19 -07:00 committed by James Valleroy
parent 969d9311ab
commit 598d7570ff
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -142,12 +142,7 @@ def revoke(domain: str):
if TEST_MODE:
command.append('--staging')
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, stderr = process.communicate()
if process.returncode:
raise RuntimeError('Error revoking certificate: {error}'.format(
error=stderr.decode()))
subprocess.run(command, check=True)
action_utils.webserver_disable(domain, kind='site')
@ -164,12 +159,7 @@ def obtain(domain: str):
if TEST_MODE:
command.append('--staging')
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, stderr = process.communicate()
if process.returncode:
raise RuntimeError('Error obtaining certificate: {error}'.format(
error=stderr.decode()))
subprocess.run(command, check=True)
with action_utils.WebserverChange() as webserver_change:
_setup_webserver_config(domain, webserver_change)
@ -330,13 +320,7 @@ def _assert_managed_path(module, path):
def delete(domain: str):
"""Disable a domain and delete the certificate."""
command = ['certbot', 'delete', '--non-interactive', '--cert-name', domain]
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, stderr = process.communicate()
if process.returncode:
raise RuntimeError('Error deleting certificate: {error}'.format(
error=stderr.decode()))
subprocess.run(command, check=True)
action_utils.webserver_disable(domain, kind='site')