← Back
Editing: hooks.cpython-38.pyc
U �][# � @ s� d Z ddlmZ ddlZddlmZmZ ddlmZm Z ddl mZ ddl mZ ddl mZ dd l mZ ddlmZ e�e�Zd d� Zdd � Zdd� Zdd� Ze� Zdd� Zdd� Zg Zdd� Zdd� Zdd� Z dd� Z!dd� Z"d d!� Z#d"d#� Z$d$d%� Z%dS )&z;Facilities for implementing hooks that call shell commands.� )�print_functionN)�Popen�PIPE)�Set�List)�errors)�util)� filesystem)�osc C s4 t | jd� t | jd� t | jd� t | jd� dS )z#Check hook commands are executable.ZpreZpostZdeploy�renewN)� validate_hook�pre_hook� post_hook�deploy_hook� renew_hook)�config� r �//usr/lib/python3/dist-packages/certbot/hooks.py�validate_hooks s r c C s. t �| �s"t�| � t �| �s"dS tj�| �S )z�Extract the program run by a shell command. :param str shell_cmd: command to be executed :returns: basename of command or None if the command isn't found :rtype: str or None N)r Z exe_exists� plug_utilZpath_surgeryr �path�basename)� shell_cmdr r r �_prog s r c C s\ | rX| � dd�d }t|�sXtjd }tj�|�r@d�||�}nd�|||�}t�|��dS )z�Check that a command provided as a hook is plausibly executable. :raises .errors.HookCommandNotFound: if the command is not found N� r �PATHz3{1}-hook command {0} exists, but is not executable.z>Unable to find {2}-hook command {0} in the PATH. (PATH is {1})) �splitr r �environr �exists�formatr ZHookCommandNotFound)r Z hook_name�cmdr �msgr r r r * s �r c C s>