diff --git a/certbot/certbot/_internal/cli/__init__.py b/certbot/certbot/_internal/cli/__init__.py index 36ee88ab7..5512a2956 100644 --- a/certbot/certbot/_internal/cli/__init__.py +++ b/certbot/certbot/_internal/cli/__init__.py @@ -164,8 +164,8 @@ def prepare_and_parse_args(plugins: plugins_disco.PluginsRegistry, args: List[st " renewal. --deploy-hook commands are not called.") helpful.add( ["testing", "renew", "certonly", "reconfigure"], - "--run-deploy-hook", action="store_true", dest="run_deploy_hook", - default=flag_default("run_deploy_hook"), + "--run-deploy-hooks", action="store_true", dest="run_deploy_hooks", + default=flag_default("run_deploy_hooks"), help="When performing a test run using `--dry-run` or `reconfigure`, run any applicable" " deploy hooks. This includes hooks set on the command line, saved in the" " certificate's renewal configuration file, or present in the renewal-hooks directory." diff --git a/certbot/certbot/_internal/constants.py b/certbot/certbot/_internal/constants.py index d072b0c08..35ee5d54e 100644 --- a/certbot/certbot/_internal/constants.py +++ b/certbot/certbot/_internal/constants.py @@ -80,7 +80,7 @@ CLI_DEFAULTS: Dict[str, Any] = dict( # noqa eab_hmac_key=None, eab_kid=None, issuance_timeout=90, - run_deploy_hook=False, + run_deploy_hooks=False, # Subparsers num=None, diff --git a/certbot/certbot/_internal/hooks.py b/certbot/certbot/_internal/hooks.py index 11ce0902f..0517e625a 100644 --- a/certbot/certbot/_internal/hooks.py +++ b/certbot/certbot/_internal/hooks.py @@ -166,7 +166,7 @@ def deploy_hook(config: configuration.NamespaceConfig, domains: List[str], """ if config.deploy_hook: _run_deploy_hook(config.deploy_hook, domains, - lineage_path, config.dry_run, config.run_deploy_hook) + lineage_path, config.dry_run, config.run_deploy_hooks) def renew_hook(config: configuration.NamespaceConfig, domains: List[str], @@ -190,7 +190,7 @@ def renew_hook(config: configuration.NamespaceConfig, domains: List[str], executed_dir_hooks = set() if config.directory_hooks: for hook in list_hooks(config.renewal_deploy_hooks_dir): - _run_deploy_hook(hook, domains, lineage_path, config.dry_run, config.run_deploy_hook) + _run_deploy_hook(hook, domains, lineage_path, config.dry_run, config.run_deploy_hooks) executed_dir_hooks.add(hook) if config.renew_hook: @@ -199,11 +199,11 @@ def renew_hook(config: configuration.NamespaceConfig, domains: List[str], config.renew_hook) else: _run_deploy_hook(config.renew_hook, domains, - lineage_path, config.dry_run, config.run_deploy_hook) + lineage_path, config.dry_run, config.run_deploy_hooks) def _run_deploy_hook(command: str, domains: List[str], lineage_path: str, dry_run: bool, - run_deploy_hook: bool) -> None: + run_deploy_hooks: bool) -> None: """Run the specified deploy-hook (if not doing a dry run). If dry_run is True, command is not run and a message is logged @@ -215,10 +215,10 @@ def _run_deploy_hook(command: str, domains: List[str], lineage_path: str, dry_ru :type domains: `list` of `str` :param str lineage_path: live directory path for the new cert :param bool dry_run: True iff Certbot is doing a dry run - :param bool run_deploy_hook: True if deploy hook should run despite Certbot doing a dry run + :param bool run_deploy_hooks: True if deploy hooks should run despite Certbot doing a dry run """ - if dry_run and not run_deploy_hook: + if dry_run and not run_deploy_hooks: logger.info("Dry run: skipping deploy hook command: %s", command) return diff --git a/certbot/certbot/_internal/main.py b/certbot/certbot/_internal/main.py index 7de59ac87..15cda3e36 100644 --- a/certbot/certbot/_internal/main.py +++ b/certbot/certbot/_internal/main.py @@ -1735,14 +1735,14 @@ def reconfigure(config: configuration.NamespaceConfig, "be found. Run `certbot certificates` to list available certificates.") # figure this out before we modify config - if config.deploy_hook and not config.run_deploy_hook: - msg = ("You are attempting to set a --deploy-hook. Would you like Certbot to run the " - "hook when it performs a dry run with the new settings? This will run all " + if config.deploy_hook and not config.run_deploy_hooks: + msg = ("You are attempting to set a --deploy-hook. Would you like Certbot to run deploy " + "hooks when it performs a dry run with the new settings? This will run all " "relevant deploy hooks, including directory hooks, unless --no-directory-hooks " "is set. This will use the current active certificate, and not the temporary test " "certificate acquired during the dry run.") - config.run_deploy_hook = display_util.yesno(msg,"Run deploy hook", - "Do not run deploy hook", default=False) + config.run_deploy_hooks = display_util.yesno(msg,"Run deploy hooks", + "Do not run deploy hooks", default=False) # cache previous version for later comparison try: