diff --git a/certbot/hooks.py b/certbot/hooks.py index 37afee9b0..5c14881e9 100644 --- a/certbot/hooks.py +++ b/certbot/hooks.py @@ -43,11 +43,11 @@ def pre_hook(config): pre_hook.already = False -def post_hook(config, final=False): +def post_hook(config, renew_final=False): """Run post hook if defined. If the verb is renew, we might have more certs to renew, so we wait until - we're called with final=True before actually doing anything. + we're called with renew_final=True before actually doing anything. """ if config.post_hook: if not pre_hook.already: @@ -55,7 +55,7 @@ def post_hook(config, final=False): if config.verb != "renew": logger.warning("Sanity failure in renewal hooks") return - if final or config.verb != "renew": + if renew_final or config.verb != "renew": logger.info("Running post-hook command: %s", config.post_hook) _run_hook(config.post_hook) diff --git a/certbot/main.py b/certbot/main.py index 2baab9670..687d872d2 100644 --- a/certbot/main.py +++ b/certbot/main.py @@ -108,7 +108,7 @@ def _auth_from_available(le_client, config, domains=None, certname=None, lineage if lineage is False: raise errors.Error("Certificate could not be obtained") finally: - hooks.post_hook(config, final=False) + hooks.post_hook(config, renew_final=False) if not config.dry_run and not config.verb == "renew": _report_new_cert(config, lineage.cert, lineage.fullchain) @@ -634,7 +634,7 @@ def renew(config, unused_plugins): try: renewal.handle_renewal_request(config) finally: - hooks.post_hook(config, final=True) + hooks.post_hook(config, renew_final=True) def setup_log_file_handler(config, logfile, fmt): diff --git a/certbot/renewal.py b/certbot/renewal.py index a057a63a9..9c847a9be 100644 --- a/certbot/renewal.py +++ b/certbot/renewal.py @@ -30,7 +30,8 @@ logger = logging.getLogger(__name__) # the renewal configuration process loses this information. STR_CONFIG_ITEMS = ["config_dir", "logs_dir", "work_dir", "user_agent", "server", "account", "authenticator", "installer", - "standalone_supported_challenges", "renew_hook"] + "standalone_supported_challenges", "renew_hook", + "pre_hook", "post_hook"] INT_CONFIG_ITEMS = ["rsa_key_size", "tls_sni_01_port", "http01_port"]