letsencrypt: Revoke certificate only if it exists

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-08-01 20:57:01 -07:00 committed by James Valleroy
parent ba4afd2a09
commit 8ece36893c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -227,10 +227,11 @@ def subcommand_revoke(arguments):
"""Disable a domain and revoke the certificate.""" """Disable a domain and revoke the certificate."""
domain = arguments.domain domain = arguments.domain
cert_path = pathlib.Path(le.LIVE_DIRECTORY) / domain / 'cert.pem'
if cert_path.exists():
command = [ command = [
'certbot', 'revoke', '--non-interactive', '--domain', domain, 'certbot', 'revoke', '--non-interactive', '--domain', domain,
'--cert-path', '--cert-path', cert_path
os.path.join(le.LIVE_DIRECTORY, domain, 'cert.pem')
] ]
if TEST_MODE: if TEST_MODE:
command.append('--staging') command.append('--staging')