mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 16:12:09 +02:00
Merge branch 'master' into save-more-hooks
This commit is contained in:
+4
-21
@@ -1,7 +1,6 @@
|
||||
"""Functionality for autorenewal and associated juggling of configurations"""
|
||||
from __future__ import print_function
|
||||
import copy
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import traceback
|
||||
@@ -11,7 +10,6 @@ import zope.component
|
||||
|
||||
import OpenSSL
|
||||
|
||||
from certbot import configuration
|
||||
from certbot import cli
|
||||
|
||||
from certbot import crypto_util
|
||||
@@ -35,17 +33,6 @@ STR_CONFIG_ITEMS = ["config_dir", "logs_dir", "work_dir", "user_agent",
|
||||
INT_CONFIG_ITEMS = ["rsa_key_size", "tls_sni_01_port", "http01_port"]
|
||||
|
||||
|
||||
def renewal_conf_files(config):
|
||||
"""Return /path/to/*.conf in the renewal conf directory"""
|
||||
return glob.glob(os.path.join(config.renewal_configs_dir, "*.conf"))
|
||||
|
||||
def renewal_file_for_certname(config, certname):
|
||||
"""Return /path/to/certname.conf in the renewal conf directory"""
|
||||
path = os.path.join(config.renewal_configs_dir, "{0}.conf".format(certname))
|
||||
if not os.path.exists(path):
|
||||
raise errors.CertStorageError("No certificate found with name {0}.".format(certname))
|
||||
return path
|
||||
|
||||
def _reconstitute(config, full_path):
|
||||
"""Try to instantiate a RenewableCert, updating config with relevant items.
|
||||
|
||||
@@ -64,8 +51,7 @@ def _reconstitute(config, full_path):
|
||||
|
||||
"""
|
||||
try:
|
||||
renewal_candidate = storage.RenewableCert(
|
||||
full_path, configuration.RenewerConfiguration(config))
|
||||
renewal_candidate = storage.RenewableCert(full_path, config)
|
||||
except (errors.CertStorageError, IOError) as exc:
|
||||
logger.warning(exc)
|
||||
logger.warning("Renewal configuration file %s is broken. Skipping.", full_path)
|
||||
@@ -247,9 +233,8 @@ def renew_cert(config, le_client, lineage):
|
||||
new_cert = OpenSSL.crypto.dump_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, new_certr.body.wrapped)
|
||||
new_chain = crypto_util.dump_pyopenssl_chain(new_chain)
|
||||
renewal_conf = configuration.RenewerConfiguration(config.namespace)
|
||||
# TODO: Check return value of save_successor
|
||||
lineage.save_successor(prior_version, new_cert, new_key.pem, new_chain, renewal_conf)
|
||||
lineage.save_successor(prior_version, new_cert, new_key.pem, new_chain, config)
|
||||
lineage.update_all_links_to(lineage.latest_common_version())
|
||||
|
||||
hooks.renew_hook(config, lineage.names(), lineage.live_dir)
|
||||
@@ -318,12 +303,10 @@ def handle_renewal_request(config):
|
||||
"command. The renew verb may provide other options "
|
||||
"for selecting certificates to renew in the future.")
|
||||
|
||||
renewer_config = configuration.RenewerConfiguration(config)
|
||||
|
||||
if config.certname:
|
||||
conf_files = [renewal_file_for_certname(renewer_config, config.certname)]
|
||||
conf_files = [storage.renewal_file_for_certname(config, config.certname)]
|
||||
else:
|
||||
conf_files = renewal_conf_files(renewer_config)
|
||||
conf_files = storage.renewal_conf_files(config)
|
||||
|
||||
renew_successes = []
|
||||
renew_failures = []
|
||||
|
||||
Reference in New Issue
Block a user