File: //lib/python3.9/site-packages/certbot/_internal/plugins/__pycache__/selection.cpython-39.pyc
a
}|�g�= � @ sL d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lm Z dd
l
mZ ddl
mZ ddl
m
Z
dd
lmZ ddlmZ ddlmZ e�e�Zd5ejee ejeee
j d�dd�Zd6ejee ejeee
j d�dd�Zd7ejee ejeee
j d�dd�Z ejejee
j d�dd�Z!e de
jd�Z"ejee ejeee ee" d�d d!�Z#eej$ eeej$ d"�d#d$�Z%g d%�Z&ejejee
j ee
j dd&�d'd(�Z'ejejeeee
j ee
j f d)�d*d+�Z(ee ee ee d,�d-d.�Z)ejeee ee f d/�d0d1�Z*eee ejdd2�d3d4�Z+dS )8z=Decide which plugins to use for authentication & installation� N)�cast)�Iterable)�List)�Optional)�Tuple)�Type)�TypeVar)�
configuration)�errors)�
interfaces)�disco)�os)�util�<How would you like to authenticate and install certificates?)�config�default�plugins�question�returnc C s t | |||tjtjf�S )zPick configurator plugin.)�pick_pluginr �
Authenticator� Installer�r r r r � r �G/usr/lib/python3.9/site-packages/certbot/_internal/plugins/selection.py�pick_configurator s
�r �+How would you like to install certificates?c C s t | |||tjf�S )zPick installer plugin.)r r r r r r r �pick_installer s r �4How would you like to authenticate with the ACME CA?c C s t | |||tjf�S )zPick authentication plugin.)r r r r r r r �pick_authenticator( s �r )r r r c s� t | �\}� � sdS |�� fdd��}|�| � t|�dkrJt�d� ��|rtt|�� �d }t� d|� |�| �S t�d� ��dS ) aB
Get an unprepared interfaces.Installer object.
:param certbot.configuration.NamespaceConfig config: Configuration
:param certbot._internal.plugins.disco.PluginsRegistry plugins:
All plugins registered as entry points.
:returns: Unprepared installer plugin or None
:rtype: Plugin or None
Nc s
| � � �S �N�Z
check_name�Zp_ep��req_instr r �<lambda>B � z*get_unprepared_installer.<locals>.<lambda>� zfFound multiple installers with the name %s, Certbot is unable to determine which one to use. Skipping.r zSelecting plugin: %sz:Could not select or initialize the requested installer %s.)
�cli_plugin_requests�filter�init�lenr
�PluginSelectionError�list�values�logger�debug)r r �_Z
installers�instr r# r �get_unprepared_installer2 s$
��
�r3 �P)�bound)r r r r �ifacesr c s� � dur|� � fdd��}n| jr,t�d��|�� }|�|�}|�| � |�� |�� }t |�dkr�t
�d|� tt
|�� �|�}|du r�dS tt|�� �S t |�dkr�t
|�� �d }t
�d|� |jr�dS |�� S t
�d � dS dS )
a� Pick plugin.
:param certbot.configuration.NamespaceConfig config: Configuration
:param str default: Plugin name supplied by user or ``None``.
:param certbot._internal.plugins.disco.PluginsRegistry plugins:
All plugins registered as entry points.
:param str question: Question to be presented to the user in case
multiple candidates are found.
:param list ifaces: Interfaces that plugins must provide.
:returns: Initialized plugin.
:rtype: Plugin
Nc s
| � � �S r r! r"