File: //usr/lib/python3.6/site-packages/certbot/_internal/plugins/__pycache__/selection.cpython-36.pyc
3
گay; � @ sj d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lm Z dd
l
mZ ddl
mZ ddl
m
Z
dd
lmZ ddlmZ ddlmZ eje�ZdEejee ejeee
j d�dd�ZdFejee ejeee
j d�dd�ZdGejee 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%d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gZ&ejejee
j ee
j dd6�d7d8�Z'ejejeeee
j ee
j f d9�d:d;�Z(ee ee ee d<�d=d>�Z)ejeee ee f d?�d@dA�Z*eee ejddB�dCdD�Z+dS )Hz=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 �/usr/lib/python3.6/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 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 r r r �pick_authenticator( s r )r r r c s� t | �\}� � sdS |j� fdd��}|j| � |jtjf�}t|�dkrXtjd� ��|r�t |j
� �d }tjd|� |j| �S tjd� ��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
| j � �S )N)�
check_name)�p_ep)�req_instr r �<lambda>B s 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�verifyr r �lenr
�PluginSelectionError�list�values�logger�debug)r r �_Z
installers�instr )r! r �get_unprepared_installer2 s
r0 �P)Zbound)r r r r �ifacesr c
s� � dk r|j � fdd��}n| jr,tjd��|j� j|�}|j| � |j|�}|j� |j � }t
|�dkr�tjd|� t
t|j� �|�}|dkr�dS tt|j� �S t
|�dkr�t|j� �d } tjd| � | jr�dS | j� S tjd � 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
| j � �S )N)r )r )r r r r"