Run post-renewal/post-issuance hooks. This function runs any hooks found in config.renewal_deploy_hooks_dir followed by any deploy-hook in the config. If the deploy-hook in the config is a path to a script in config.renewal_deploy_hooks_dir, it is not run twice. If Certbot is d
(config: configuration.NamespaceConfig, sans: list[san.SAN],
lineage_path: str)
| 190 | |
| 191 | |
| 192 | def deploy_hook(config: configuration.NamespaceConfig, sans: list[san.SAN], |
| 193 | lineage_path: str) -> None: |
| 194 | """Run post-renewal/post-issuance hooks. |
| 195 | |
| 196 | This function runs any hooks found in |
| 197 | config.renewal_deploy_hooks_dir followed by any deploy-hook in the |
| 198 | config. If the deploy-hook in the config is a path to a script in |
| 199 | config.renewal_deploy_hooks_dir, it is not run twice. |
| 200 | |
| 201 | If Certbot is doing a dry run, no hooks are run and messages are |
| 202 | logged saying that they were skipped. |
| 203 | |
| 204 | :param configuration.NamespaceConfig config: Certbot settings |
| 205 | :param sans: domains and/or IP addresses in the obtained certificate |
| 206 | :type sans: `list` of `san.SAN` |
| 207 | :param str lineage_path: live directory path for the new cert |
| 208 | |
| 209 | """ |
| 210 | executed_hooks = set() |
| 211 | all_hooks: list[str] = (list_hooks(config.renewal_deploy_hooks_dir) if config.directory_hooks |
| 212 | else []) |
| 213 | all_hooks += [config.deploy_hook] if config.deploy_hook else [] |
| 214 | for hook in all_hooks: |
| 215 | if hook in executed_hooks: |
| 216 | logger.info("Skipping deploy-hook '%s' as it was already run.", hook) |
| 217 | else: |
| 218 | _run_deploy_hook(hook, sans, lineage_path, config.dry_run, config.run_deploy_hooks) |
| 219 | executed_hooks.add(hook) |
| 220 | |
| 221 | |
| 222 | def _run_deploy_hook(command: str, sans: list[san.SAN], lineage_path: str, dry_run: bool, |