%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/plugins/become/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/plugins/become/__pycache__/__init__.cpython-39.pyc

a

�)g��@s�ddlmZmZmZeZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZddlmZdd	lmZddd�ZGd
d�de�ZdS)�)�absolute_import�division�print_functionN)�abstractmethod)�choice)�ascii_lowercase)�dgettext)�AnsibleError)�to_bytes)�
AnsiblePlugin� cCsd�dd�t|�D��S)zH return random string used to identify the current privilege escalation �css|]}tt�VqdS�N)rr)�.0�x�r�C/usr/lib/python3.9/site-packages/ansible/plugins/become/__init__.py�	<genexpr>�z_gen_id.<locals>.<genexpr>)�join�range)�lengthrrr�_gen_idsrcs�eZdZdZe�Ze�ZdZdZ�fdd�Z	d�fdd�	Z
dd	�Zdd
d�Ze
dd
��Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�
BecomeBaseNFr
cstt|���d|_d|_dS)Nr
)�superr�__init__�_id�success��self��	__class__rrr'szBecomeBase.__init__csLztt|�j||d�WStyFgd�}||vr6�t||d�YS0dS)z� Overrides the base get_option to provide a fallback to playcontext vars in case a 3rd party plugin did not
        implement the base become options required in Ansible. )�hostvars)Zbecome_user�become_passZbecome_flagsZ
become_exeN)rr�
get_option�KeyError�getattr)r�optionr"ZplaycontextZpc_fallbackr rrr$,szBecomeBase.get_optioncCs|jo|�d�S)z�This function assists connection plugins in determining if they need to wait for
        a prompt. Both a prompt and a password are required.
        r#)�promptr$rrrr�
expect_prompt9szBecomeBase.expect_promptcCs�t|||jf�s|Sz t�d|j|j|j|f�}Wn&tyZtd|j|j	f��Yn0t
|dd�}|r||s|d||f}|S)Nz%s %s %s %sz=The %s shell family is incompatible with the %s become plugin�
executablez%s -c %s)�allr�shlex�quoteZECHOZCOMMAND_SEP�AttributeErrorr	ZSHELL_FAMILY�namer&)r�cmd�shellZnoexeZexerrr�_build_success_command?s z!BecomeBase._build_success_commandcCst�|_d|j|_dS)NzBECOME-SUCCESS-%s)rrr)rr0r1rrr�build_become_commandMszBecomeBase.build_become_commandcs&t|j��t�fdd�|�d�D��S)Nc3s|]}�|��vVqdSr)�rstrip�r�l�Z	b_successrrrTrz+BecomeBase.check_success.<locals>.<genexpr>T)r
r�any�
splitlines�r�b_outputrr7r�
check_successRs
zBecomeBase.check_successcs2|jr.t|j����t�fdd�|��D��SdS)z; checks if the expected password prompt exists in b_output c3s|]}|�����VqdSr)�strip�
startswithr5�Zb_promptrrrZrz3BecomeBase.check_password_prompt.<locals>.<genexpr>F)r(r
r=r8r9r:rr?r�check_password_promptVsz BecomeBase.check_password_promptcCstt|j|��}|o||vS)zM returns True/False if domain specific i18n version of msg is found in b_out )r
rr/)rZb_out�msgZb_failrrr�_check_password_error]sz BecomeBase._check_password_errorcCs"|jD]}|�||�rdSqdS�NTF)�failrB�rr;Z	errstringrrr�check_incorrect_passwordbs
z#BecomeBase.check_incorrect_passwordcCs"|jD]}|�||�rdSqdSrC)�missingrBrErrr�check_missing_passwordhs
z!BecomeBase.check_missing_password)NN)F)�__name__�
__module__�__qualname__r/�tuplerDrGZrequire_ttyr(rr$r)r2rr3r<r@rBrFrH�
__classcell__rrr rrs 


r)r)Z
__future__rrr�typeZ
__metaclass__r,�abcrZrandomr�stringr�gettextrZansible.errorsr	Zansible.module_utils._textr
Zansible.pluginsrrrrrrr�<module>s


Zerion Mini Shell 1.0