Improve the "certbot certificates" output (#3846)

* Begin making "certbot certificates" future safe

* Handle the case where a renewal conf file has no "server" entry
This commit is contained in:
Peter Eckersley
2016-12-07 16:02:13 -08:00
committed by Erica Portnoy
parent 59c602d9ca
commit cc86ff2a21
6 changed files with 56 additions and 15 deletions
+2 -6
View File
@@ -13,7 +13,6 @@ import OpenSSL
from certbot import configuration
from certbot import cli
from certbot import constants
from certbot import crypto_util
from certbot import errors
@@ -209,9 +208,6 @@ def should_renew(config, lineage):
def _avoid_invalidating_lineage(config, lineage, original_server):
"Do not renew a valid cert with one from a staging server!"
def _is_staging(srv):
return srv == constants.STAGING_URI or "staging" in srv
# Some lineages may have begun with --staging, but then had production certs
# added to them
latest_cert = OpenSSL.crypto.load_certificate(
@@ -220,8 +216,8 @@ def _avoid_invalidating_lineage(config, lineage, original_server):
# we should test more methodically
now_valid = "fake" not in repr(latest_cert.get_issuer()).lower()
if _is_staging(config.server):
if not _is_staging(original_server) or now_valid:
if util.is_staging(config.server):
if not util.is_staging(original_server) or now_valid:
if not config.break_my_certs:
names = ", ".join(lineage.names())
raise errors.Error(