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 saying that it was skipped. If dry_run is False, the hook is run after setting the appropriate environment variables. :param str command: command to run as a deplo
(command: str, sans: list[san.SAN], lineage_path: str, dry_run: bool,
run_deploy_hooks: bool)
| 220 | |
| 221 | |
| 222 | def _run_deploy_hook(command: str, sans: list[san.SAN], lineage_path: str, dry_run: bool, |
| 223 | run_deploy_hooks: bool) -> None: |
| 224 | """Run the specified deploy-hook (if not doing a dry run). |
| 225 | |
| 226 | If dry_run is True, command is not run and a message is logged |
| 227 | saying that it was skipped. If dry_run is False, the hook is run |
| 228 | after setting the appropriate environment variables. |
| 229 | |
| 230 | :param str command: command to run as a deploy-hook |
| 231 | :param sans: domains and/or IP addresses in the obtained certificate |
| 232 | :type sans: `list` of `san.SAN` |
| 233 | :param str lineage_path: live directory path for the new cert |
| 234 | :param bool dry_run: True iff Certbot is doing a dry run |
| 235 | :param bool run_deploy_hooks: True if deploy hooks should run despite Certbot doing a dry run |
| 236 | |
| 237 | """ |
| 238 | if dry_run and not run_deploy_hooks: |
| 239 | logger.info("Dry run: skipping deploy hook command: %s", |
| 240 | command) |
| 241 | return |
| 242 | |
| 243 | os.environ["RENEWED_DOMAINS"] = " ".join(map(str, sans)) |
| 244 | os.environ["RENEWED_LINEAGE"] = lineage_path |
| 245 | _run_hook("deploy-hook", command) |
| 246 | |
| 247 | |
| 248 | def _run_hook(cmd_name: str, shell_cmd: str, extra_env: Optional[dict[str, str]] = None) -> str: |
no test coverage detected