certbot.hooks

Facilities for implementing hooks that call shell commands.

certbot.hooks.validate_hooks(config)[source]

Check hook commands are executable.

certbot.hooks._prog(shell_cmd)[source]

Extract the program run by a shell command.

Parameters:shell_cmd (str) – command to be executed
Returns:basename of command or None if the command isn’t found
Return type:str or None
certbot.hooks.validate_hook(shell_cmd, hook_name)[source]

Check that a command provided as a hook is plausibly executable.

Raises:errors.HookCommandNotFound – if the command is not found
certbot.hooks.pre_hook(config)[source]

Run pre-hook if it’s defined and hasn’t been run.

certbot.hooks.post_hook(config)[source]

Run post hook if defined.

If the verb is renew, we might have more certs to renew, so we wait until run_saved_post_hooks() is called.

certbot.hooks.run_saved_post_hooks()[source]

Run any post hooks that were saved up in the course of the ‘renew’ verb

certbot.hooks.deploy_hook(config, domains, lineage_path)[source]

Run post-issuance hook if defined.

Parameters:
  • config (configuration.NamespaceConfig) – Certbot settings
  • domains (list of str) – domains in the obtained certificate
  • lineage_path (str) – live directory path for the new cert
certbot.hooks.renew_hook(config, domains, lineage_path)[source]

Run post-renewal hook if defined.

certbot.hooks._run_hook(shell_cmd)[source]

Run a hook command.

Returns:stderr if there was any
certbot.hooks.execute(shell_cmd)[source]

Run a command.

Returns:tuple (str stderr, str stdout)