%PDF- %PDF-
Mini Shell

Mini Shell

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

a

�)gz��@s�ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZmZmZmZmZddlmZddlmZddlmZddlm Z dd	l!m"Z"m#Z#dd
l$m%Z%ddl&m'Z'ddl(m)Z)dd
l*m+Z+ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;m<Z<ddl=m>Z>m?Z?ddl@mAZAddlBmCZCmDZDeA�ZEdd�ejF�G�D�ZHdgZIGdd�deJ�ZKdd�ZLdd�ZMGdd�d�ZNd d!�ZOdS)"�)�absolute_import�division�print_functionN)�	constants)�AnsibleError�AnsibleParserError�AnsibleUndefinedVariable�AnsibleConnectionFailure�AnsibleActionFail�AnsibleActionSkip)�
TaskResult)�get_action_args_with_defaults)�boolean)�binary_type)�to_text�	to_native)�write_to_file_descriptor)�Conditional)�Task)�get_plugin_class)�
become_loader�cliconf_loader�connection_loader�httpapi_loader�netconf_loader�terminal_loader)�Templar)�AnsibleCollectionConfig�AnsibleCollectionRef)�listify_lookup_plugin_terms)�to_unsafe_text�wrap_var)�namespace_facts�clean_facts)�Display)�combine_vars�isidentifiercCs g|]}d|vrd|vr|�qS)�becomeZ_pass�)�.0�xr(r(�B/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py�
<listcomp>(�r,�TaskExecutorc@seZdZdS)�TaskTimeoutErrorN)�__name__�
__module__�__qualname__r(r(r(r+r/-sr/cCst�dS�N)r/)Zsignum�framer(r(r+�task_timeout1sr5cs�t|t�s|Si}|��D]x}|d�kr.qqt|dt�rTt|d��||d<qt|dt�r��fdd�|dD�||d<q|d||d<q|S)z�
    Remove args with a value equal to the ``omit_token`` recursively
    to align with now having suboptions in the argument_spec
    �rcsg|]}t|���qSr()�remove_omit)r)�v��
omit_tokenr(r+r,Er-zremove_omit.<locals>.<listcomp>)�
isinstance�dict�itemsr7�list)Z	task_argsr:�new_args�ir(r9r+r75s
 r7c@s|eZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zdd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd
S)r.z�
    This is the main worker class for the executor pipeline, which
    handles loading an action plugin to actually dispatch the task to
    a given host. This class roughly corresponds to the old Runner()
    class.
    c		CsJ||_||_||_||_||_||_||_d|_||_d|_	|j�
�dSr3)�_host�_task�	_job_vars�
_play_context�
_new_stdin�_loader�_shared_loader_obj�_connection�_final_q�_loop_eval_errorZsquash)	�self�host�taskZjob_vars�play_contextZ	new_stdin�loader�shared_loader_objZfinal_qr(r(r+�__init__UszTaskExecutor.__init__cs�t�d|jj��z2�z�z|��}Wn.tyT}zd}||_WYd}~n
d}~00|du�r�t|�dk�r�|�|�}t	|d�}d|d<|D�]}d|vr�|dr�|�
d�s�d|d<|dr�d|vs�d|vr�|ds�d|d<d	|v�r:|d	�r:|�d
�}|�
d	��s"d|d	<d|d<||j_n|jj�r:|�s:||j_d
D]d}||v�r>||�r>||v�rhg||<t
||t��s�||g||<||||||<||=�q>q�|�
d	d��s�d|d<|d�r�d|d<nt	dddgd�}nt�d�|��}t�d�d|v�rd|d<d �fdd�	�t�d��|�}t�d�|WWz|j��WSt�ybYSt�y�}zt�dt|��WYd}~Sd}~00St�y:}z�t	dtt|dd��|jjd�WYd}~Wz|j��WSt�y�YSt�y.}zt�dt|��WYd}~Sd}~00Sd}~0t�y�}z�t	dtdt|dd��tt���d|jjd�WYd}~Wz|j��WSt�y�YSt�y�}zt�dt|��WYd}~Sd}~00Sd}~00Wz|j��WnJt�yYn8t�yD}zt�dt|��WYd}~n
d}~00n\z|j��WnJt�yjYn8t�y�}zt�dt|��WYd}~n
d}~000dS)!a
        The main executor entrypoint, where we determine if the specified
        task requires looping and either runs the task with self._run_loop()
        or self._execute(). After that, the returned results are parsed and
        returned as a dict.
        zin run() - task %sNr)�resultsT�skipped�changedF�failed�_ansible_ignore_errorszOne or more items failed�msg)�warningsZdeprecationszAll items completedzAll items skippedzNo items in the list)rTrSZskipped_reasonrRzcalling self._execute()z_execute() done�surrogate_or_strictc	s�t|t�rt||d�St|t�r�|D]Z}z�|||d�||<Wq$ty||dkrvt�d��||dd�||<n�Yq$0q$n,t|t�r�t|�D]\}}�||d�||<q�|S)N��errors�diffz{We were unable to decode all characters in the module return data. Replaced some in an effort to return as much as possible�surrogate_then_replace)	r;rr r<�UnicodeError�display�warningr>�	enumerate)�resr[�k�idx�item��
_clean_resr(r+rg�s



z$TaskExecutor.run.<locals>._clean_reszdumping result to jsonzdone dumping result, returningzerror closing connection: %sZ
simplerepr)Z	nonstring)rUrW�_ansible_no_logz.Unexpected failure during module execution: %s�)rUrW�	exception�stdoutrh)rY)r_�debugrB�_uuid�_get_loop_itemsrrJ�len�	_run_loopr<�get�pop�
ignore_errorsr;r>�_executerH�close�AttributeError�	Exceptionrrr!rD�no_logr�	traceback�
format_exc)rKr=�eZitem_resultsrbreZitem_ignoreZarrayr(rfr+�runcs�



 









(�*(�
�(�*�zTaskExecutor.runcsh|j��|jd<|j��|jdvr:|jd�|j���t|j|jd��d}|j�d�}|durh|}n�|jj�r0|jj|j	j
v�rd}|jjdkr�d}t|jj�|dd�}|s‡fd	d
�|D�}|j	j
j|jj|j�d�}dD]}||jj
vr�q�q�t|d
|d�t|j||jdd��}ntd|jj��n4|jjdu�rd��|jj�}t|t��sdtd|��|S)z�
        Loads a lookup plugin to handle the with_* portion of a task (if specified),
        and returns the items result.
        Zansible_search_path�rO�	variablesNZ_ansible_loop_cacheTZfirst_foundF)�terms�templarZfail_on_undefinedZconvert_barecsg|]}��|�s|�qSr()Zis_template)r)�t�r�r(r+r,�r-z0TaskExecutor._get_loop_items.<locals>.<listcomp>)rOr�)�template�var�fileZ_subdir�s)rr~ZwantlistzSUnexpected failure in finding the lookup named '%s' in the available lookup pluginsz�Invalid data passed to 'loop', it requires a list, got this instead: %s. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup.)rBZget_search_pathrCrFZget_basedir�appendrrqZ	loop_withrGZ
lookup_loaderrZloop�action�setattrr!r|rr�r;r>)rKr=Z
loop_cacheZfailZ
loop_termsZmylookupZsubdirr(r�r+rn�s@
��zTaskExecutor._get_loop_itemscCs$|j}t|j|d�}|jjj|d�|jjj}|jjj}|jjj}|jjj	}|jjj
}|jjjpjd|d}	||vr�t�
d|j|f�d}
d}t|�}g}
t|�D�]p\}}||d<|||<|r�||d<|||<|�rn|d	||d
k|d	|k|||||d	d�|d<|�r||dd
<z||d	|dd<Wnt�yJYn0|d	d
k�rn||d	|dd<||_|�r�|
�r�t�|�nd}
z(|jjddd�}|jj|_|j��}WnHt�y}z.|
�tdt|�d��WYd}~q�WYd}~n
d}~00||j|_}||j|_}|j|d�}|j��}||j|_}||j|_}|�pZ|j}|||<||d<|�r�|||<||d<|�r�|d|d<d|d<|�d�|d<z|�|	�|d<Wn>t �y�}z$|�!ddt|�d��WYd}~n
d}~00t"|j#j$|jj%||d�}|�&��s(|�'��r8|j(�)d|�nV|�*��rR|j(�)d|�n<t+|jdd��rp|j(�)d|�|jj,t-j.v�r�|j(�)d|�|
�|�||=|j/r�|j/j0|j/j1j0d �}|j/j2�r�|j/j2j0|d!<|�3�D]<\}}t-j4�5||�D]"}||v�r�||jv�r�||=�q�q�q�||j_|
S)"z�
        Runs the task with the loop items specified and collates the result
        into an array named 'results' which is inserted into the final result
        along with the item for which the loop ran.
        r}r�z{{z}}z�%s: The loop variable '%s' is already in use. You should set the `loop_var` value in the `loop_control` option for the task to something else to avoid variable collisions and unexpected behavior.FZansible_loop_varZansible_index_varr6r)�indexZindex0�first�last�lengthZrevindexZ	revindex0Zansible_loopZallitemsZnextitemZprevitemT)Zexclude_parentZ
exclude_tasks�rUrWN)r~Z_ansible_item_resultrsrVZ_ansible_item_labelz)Failed to template loop_control.label: %s��task_fieldsZv2_runner_item_on_failedZv2_runner_item_on_skippedr\Zv2_on_file_diffZv2_runner_item_on_ok)�
connection�shellr')6rCrrFrBZloop_control�
post_validate�loop_var�	index_var�pause�extended�extended_allitems�labelr_r`rora�
IndexError�available_variables�time�sleep�copy�_parentrDrr�r<rrt�
dump_attrsrxrqr�r�updaterrA�namermZ	is_failedZis_unreachablerI�
send_callbackZ
is_skipped�getattrr��CZ_ACTION_INVENTORY_TASKSrH�
_load_nameZ_shellr'r=�config�get_plugin_vars)rKr=�	task_varsr�r�r�Z
loop_pauser�r�r�Zran_oncerxZ	items_lenrRZ
item_indexreZtmp_taskZtmp_play_contextr{rbr��trZ
clear_plugins�plugin_typeZplugin_namer�r(r(r+rps�




�

�
	
"

��

�
zTaskExecutor._run_loopNc s2|dur�j}t�j|d��d}|��}zH�jj�j|�d��_�jj�d��jjsb�j	j
�j_�j�|�Wn(ty�}z|}WYd}~n
d}~00�jj
}z.�j��|�s�t�d�tddd|d	�WSWnHt�y}z.�jdu�rt�t|���j��WYd}~n
d}~00�jdu�r,�j�|du�r�d}�jj�r~t|t��rVd}n(t|t��r~t|d
d�}t|t��r~d}|�r�|�|�_�jjtjv�rވjj��}|�dd�}	|	�s�tddd
�S�� |	�}	t|	|d�S�jjtj!v�r�jj��}t|d�Sz�jj�d�Wn@t�y,�Yn,t"�yVtdd|tt#�$��d�YS0d�jjv�r��jj�d�}
t|
t��r�tj%�r�t�&d�|
�'�jj�|
�j_ntd|
�d����jj
}i}�jj�r�|�(di��(�jji�}n|}|�_|�(d�du�r�� |d�}n�jj)}�j*�rXt�j*dd��rX�j*�+|g��rX�jj�j*jjk�rj��,|�|��_*n�j�j*_��-|��j*���.|��}
|����j*�����_�jj�j��d��j*_t/�j*j0�o�tj1�j*j2f��r\�j*�3d��j_4tj5d�jjd�tj5d�j*j6�jjd��j*�7�}t8�j|�jj9�}tj5d|�jjd�t:�j*d|�d|v�rzd|v�rzt;j<|d<�j=�j*�d �\�_>}|du�r�|j?}n�jj@}tA|�jj�jjB��jjCjDjEd!��j_|�(d"�}|du�r�tF�jj|��j_�jjG�r2�jjH}|du�rd#}n|d$k�r(d%}n|d%7}nd%}�jjI}|d$k�rLd%}t�d&�d}tJd%|d%�D�]n}t�d'��z�z:�jj4�r�tK�KtKjLtM�}tK�N�jj4��j>jO�d(�}W�n>tPtQf�y}zD|jRWYd}~W�jj4�rtK�Nd$�tK�KtKjL|�}�j>�S�Sd}~0tT�y~}zNtdt|�d)�WYd}~W�jj4�rftK�Nd$�tK�KtKjL|�}�j>�S�Sd}~0tU�y�}z^d*�jj�jj4f}td|d
�WYd}~W�jj4�r�tK�Nd$�tK�KtKjL|�}�j>�S�Sd}~00W�jj4�rtK�Nd$�tK�KtKjL|�}�j>�S�n.�jj4�rHtK�Nd$�tK�KtKjL|�}�j>�S�0t�d+�tV|�pp|�(d,d��|d,<�jjtjWv�r�tX|�}�jjY�r�tZ�jjY��s�td-�jjY��|��jjY<�jj[d$k�rn�jj\d$k�rf|�(d.��sf|�(d/��sf�j]|��d0�}|�(d/��r>�j^�_d1t`�j	ja�jj9|�j�b�d2��n(�j^�_d3t`�j	ja�jj9|�j�b�d2��||d,<���fd4d5�}���fd6d7�}d8|v�	rD�jjtjcv�	rD�jjtjWv�	r�jj�r��jjd�r�d9�v�r�d9�'|d8�n|d8�d9<n��'|d8�n<tX|d8�}te��(d8i�tf|���d8<tj%�	rD��'tg|��d/|v�	rxd:|v�	rp|d:d;v�	rpd|d/<nd|d/<�jjG�	r�||d<<d=|v�	r�d|d=<�jjtjWv�	r�tX|�}�jjY�	r�|��jjY<d.|v�
r0d=}z||�d/}||�Wn>t�
y.}z$d|d/<t|�|d>|<WYd}~n
d}~00|d%k�rhth�jd?�}�jjG|_i|�����
rf�
q�np||k�rhd|d@<||dA<t�dB||f��j^�_dCt`�j	ja�jj9|�j�b�d2��tj�k|��jl�j*�d ��_>�qh|d%k�
r�|d%|d<<d|d/<�jjtjWv�rtX|�}�jjY�r&||�jjY<d8|v�r��jjtjcv�r��jjtjWv�r`|�'|d8�n<tX|d8�}te|�(d8i�tf|��|d8<tj%�r�|�'tg|���jjmdu�r��jjm|dD<�jj�r$dE�jji|d9<|
D]}|�(|�|d9|<�q�dFD]0}||d9v�r�||v�r�|�(|�|d9|<�q�t�dG�|S)Hz�
        The primary workhorse of the executor system, this runs the task
        on the specified host (which may be the delegated_to host) and handles
        the retry/until and block rescue/always execution
        Nr})rMr~r�r�z,when evaluation is False, skipping this taskFTzConditional result was False)rTrSZskip_reasonrh�orig_excZ_raw_paramsz,No include file was specified to the includer�)Zinclude�include_args)r�)rTrUrhrjZ_variable_paramsz�Using a variable for a task's 'args' is unsafe in some situations (see https://docs.ansible.com/ansible/devel/reference_appendices/faq.html#argsplat-unsafe)z invalid or malformed argument: '�'Zansible_delegated_vars�ansible_connectionZ	connectedZpersistent_command_timeoutzattempting to start connection�rLzusing connection plugin %szlocal domain socket path is %sZ_socket_pathZansible_network_osZansible_python_interpreter)r�r�)Z
action_groupsZomit�rr6zstarting attempt loopzrunning the handler�r�)ZunreachablerWzRThe %s action failed to execute in the expected time frame (%d) and was terminatedzhandler run completerhz3Invalid variable name in 'register' specified: '%s'rSrU)�resultr�r�Zv2_runner_on_async_failedr�Zv2_runner_on_async_okcs>�jjdur:�jjr:t�jd�}�jj|_|����|d<dS)N�rOrT)rBZchanged_whenrrF�when�evaluate_conditional)r��cond�rKr�Z	vars_copyr(r+�_evaluate_changed_when_result�s
z<TaskExecutor._execute.<locals>._evaluate_changed_when_resultcsD�jjr<t�jd�}�jj|_|����}||d<|d<nd}|S)Nr��failed_when_resultrUF)rBZfailed_whenrrFr�r�)r�r�r�r�r(r+�_evaluate_failed_when_result�s
z;TaskExecutor._execute.<locals>._evaluate_failed_when_resultZ
ansible_factsZ_ansible_delegated_vars�rc)r�0ZattemptsrTz%s_when_resultr�Z_ansible_retry�retrieszRetrying task, attempt %d of %dZv2_runner_retryZ_ansible_notifyZansible_delegated_host)Zansible_hostZansible_portZansible_userr�z'attempt loop complete, returning result)nrCrrFr�rDZset_task_and_variable_overriderBr��remote_addrrA�addressZupdate_varsrrxr�r_rlr<rJr8rZdelegate_tor;rrr�r�r�r�Z_ACTION_ALL_INCLUDE_TASKS�argsrrr�Z_ACTION_INCLUDE_ROLErwryrzZINJECT_FACTS_AS_VARSr`r�rqr�rHZmatches_name�_get_connection�_set_become_plugin�_set_connection_options�anyZsupports_persistenceZUSE_PERSISTENT_CONNECTIONSZforce_persistence�
get_option�timeout�vvvvZ	transportZget_options�start_connectionrmr��sys�
executable�'_get_action_handler_with_module_contextZ_handlerZ
resolved_fqcnZresolved_actionr
Zmodule_defaultsr�Z_play�_action_groupsr7Zuntilr��delay�range�signal�SIGALRMr5�alarmr|r
rr��cleanupr	r/�boolZ_ACTION_WITH_CLEAN_FACTSr!�registerr&�	async_val�poll�_poll_async_resultrIr�rr�r�Z
_ACTION_DEBUGZdelegate_factsr%r"r#rr�r�r��_get_action_handler�notify) rKr~Zcontext_validation_errorZtempvarsr{rxZraiseitr�r�Zinclude_fileZvariable_params�cvars�current_connectionZplugin_vars�options�socket_pathZmodule_contextZmodule_defaults_fqcnr:r�r�r�ZattemptZold_sigrWr�r��af�condnamer�rcZrequireshedr(r�r+rt�s







���




�













�


�


�

�



&����







&


��	




zTaskExecutor._executecCsB|dur|j}|�d�}|dur,tddd�St�tdd|i|jjd��}|jjjd	||j	|j
|j||jd
�}|jj}|dk�r�t
�|jj�zF|j|d�}t|�d
d��dks�d|vr�|�dd�s�d|vr�W�q�Wn�t�y\}	zpt�dt|	��t�dtt����z|j	��Wnt�y.Yn0||jj8}|dk�rH�WYd}	~	qtd}	~	00||jj8}|j�dt|jj|j ||�!�d��qtt|�d
d��dk�r�|�d��r�tdd|jj|d�Stdd|d�Snft�|dd�|jjd��}
|jjjd	|
|j	|j
|j||jd
�}|j|d�|j"dd�|j"dd�|SdS)z<
        Polls for the specified JID to be complete
        NZansible_job_idTz(No job id was returned by the async taskr��async_status�jid)r�r��environmentzansible.legacy.async_status)rMr�rNrOr�rPrr��finishedr6rUZ_ansible_parsedFrSz-Exception during async poll, retrying... (%s)zAsync poll exception was:
%sZv2_runner_on_async_pollr�z;async task did not complete within the requested time - %ss)rUrW�async_resultz'async task produced unparseable resultsr�)r��mode)r�r�)�force)#rCrqr<r�loadrBr�rG�
action_loaderrHrDrFr�r�r�r�r|�intrwr_r�rrlryrz�resetrvrIr�rrAr�rmr�r�)rKr�r�r�Z	async_jidZ
async_taskZ
async_handlerZ	time_leftr�r{Zcleanup_taskZcleanup_handlerr(r(r+r�8s�
�

�
��

��
���	�	zTaskExecutor._poll_async_resultcCst�|�}|std|��|S)Nz�Invalid become method specified, could not find matching plugin: '%s'. Use `ansible-doc -t become -l` to list available plugins.)rrqr)rKr�r'r(r(r+�_get_become�s
�zTaskExecutor._get_becomecCsj||j_|jj}|jjj||j|j|jjtt	�
��d�\}}|sLtd|��|�|||�|j�
|�|S)z�
        Reads the connection property for the host, and returns the
        correct connection object from the list of connection plugins
        )�	task_uuidZansible_playbook_pidz(the connection plugin '%s' was not found)rDr�rGrZget_with_contextrErBrmr�os�getppidrr�Zset_attributes_from_plugin)rKr�r�r�Z	conn_typer�Zplugin_load_contextr(r(r+r��s
�
zTaskExecutor._get_connectioncCs�|�d�dur"t|�|d��}n|jj}|r^|�d�rN|�|�|d��}qb|�|jj�}nd}z|�|�Wnty�Yn0|r�t	|jdd�r�t	|dd�s�t
d|j|jf��|j
�|j�dS)NZansible_becomeZansible_become_methodZrequire_ttyFZhas_ttyz`The '%s' connection does not provide a TTY which is required for the selected become plugin: %s.)rqrr�rBr'r�Z
become_methodZset_become_pluginrvr�rr�r�rD)rKr�r�r�r'Z
become_pluginr(r(r+r��s(

��zTaskExecutor._set_become_pluginc	Cs�zt|jd|�}Wnty2t|j|�}Yn0|dkr@d}tj�||j�}i}|D]}||vrX|�||�||<qX|j||d�|S)Nz_%s�
ssh_type_connr���	task_keysZvar_options)	r�rHrvr�r�r�r�r��set_options)	rKr�r~r�r�Zplugin�option_varsr�rcr(r(r+�_set_plugin_options�sz TaskExecutor._set_plugin_optionsc	Cs�g}tj�d|jj�}|�|�dii}|D]}||vr,|�||�||<q,t|jdd�r�|D]4}|�d|jj�r^||vr^|�||�|d|<q^|j	�
�}|jj|d<|jj
r�|jj
|d<|d=|jj||d	�|�|�d
|||��|jjdu�rp|jj�r|jj|d<|�|�d|||��d
D]8}zt|j||jj�|��Wnt�y\Yn0�q(|jjj|j_t|jdd�}	|	du�r�|	�d�dk�r�t|	�d��}
|�|�|
|||��t|jdd�}|du�r�|�|�d|||��|S)Nr�Z_extrasZallow_extrasFzansible_%s_r��passwordr�r�r��become_passr')Zbecome_userZbecome_flagsZ
become_exer�Z_sub_plugin�typeZexternal�objr�)r�r�r�rHr��extendr�r��
startswithrBr�rDr�r�r�r�r'r�r�r��KeyError�promptrqr)rKr~r�Zvarnamesr�r�rcr��option�subr�Zsub_connr(r(r+r�sH




z$TaskExecutor._set_connection_optionscCs|�||�dS)zX
        Returns the correct action plugin to handle the requestion task action
        r)r�)rKr�r�r(r(r+r�Fsz TaskExecutor._get_action_handlerc
Cs$|jj�d�\}}}|�d�d}|r4d�||�}n|}|jj}|jjj|jj|d�}	|	j	rb|	j
sfd}	|	durv|	j
}
nn|jjj|jj|d�r�|jj}
nNt
|tjv|jjj||d�f�r�|}
tjdj|
|jjd�|jjd	�nd
}
d}|jjj|
|j||j|j||j|d�}|�std|
��||	fS)
zo
        Returns the correct action plugin to handle the requestion task action and the module context
        �.�_rz{0}.{1})�collection_listNz1Using network group action {handler} for {action})�handlerr�r�zansible.legacy.normal)rMr�rNrOr�rPrzthe handler '%s' was not found)rBr��
rpartition�split�format�collectionsrGZ
module_loaderZfind_plugin_with_contextZresolvedZ
action_pluginr�Z
has_plugin�allr�ZNETWORK_GROUP_MODULESr_r�rDr�rqrFr)rKr�r�Zmodule_collection�	separatorZmodule_nameZ
module_prefixZnetwork_actionr�moduleZhandler_namerr(r(r+r�LsJ�
 
���z4TaskExecutor._get_action_handler_with_module_context)N)N)r0r1r2�__doc__rQr|rnrprtr�r�r�r�r�r�r�r�r(r(r(r+r.Ls$h8
)
i$FcCs�tjptj�tjd�g}|�tj�	dd��
tj��|D]2}tj�|d�}tj�
|�r:t�d�|��qvq:td��tj��}|�t��t��ttj�tj��t��t��t��t��d��g}tjr�|�dd	tj�tj }t!�"�\}	}
t#j$||g|�t%t�&���t%|��|
t#j't#j'|d
�}t�(|
�t)�*|	�}t)�*|	�}
|
dt)j+@|
d<zHt)�,|	t)j-|
�t.|	|�t.|	|�/��|�0�\}}Wt)�,|	t)j-|�nt)�,|	t)j-|�0t�(|	�|j1dk�r�t2�3t%|dd
��}nFzt2�3t%|dd
��}Wn.t4t2j5dt6��y dt%|dd
�i}Yn0d|v�r�|dD]p\}}|dk�rVtj|dd�nL|dv�rvt4t|�||j7d�n,t8t|��r�t4t|�|�ntj||j7d��q4d|v�r�tjdk�r�|�	d��r�d|d}tj|tj9d�t|d��|dS)z*
    Starts the persistent connection
    r�PATHrizansible-connectionz$Found ansible-connection at path {0}ziUnable to find location of 'ansible-connection'. Please set or check the value of ANSIBLE_CONNECTION_PATH)ZANSIBLE_BECOME_PLUGINSZANSIBLE_CLICONF_PLUGINSZANSIBLE_COLLECTIONS_PATHZANSIBLE_CONNECTION_PLUGINSZANSIBLE_HTTPAPI_PLUGINSZANSIBLE_NETCONF_PLUGINSZANSIBLE_TERMINAL_PLUGINSz-%sr8)�stdinrk�stderr�envr�r]rZZJSONDecodeError�error�messages�logT)Zlog_only)rlr8ZvvZvvvr�ZvvvvvZvvvvvvr��rjzThe full traceback is:
)Zcolorr�):r�ZANSIBLE_CONNECTION_PATHr��path�dirnamer��argvr��environrqr�pathsep�join�isfiler_r�rrr�r�rZprint_pathsrrrZcollection_pathsrrrr�	verbosityr�r��pty�openpty�
subprocess�Popenrr��PIPEru�termiosZ	tcgetattrZICANONZ	tcsetattrZTCSANOWrZ	serializeZcommunicate�
returncode�json�loadsr��decoder�
ValueErrorr��hasattrZCOLOR_ERROR)rNr�r�Zcandidate_pathsrr�rrZpythonZmasterZslave�p�old�newrkrr��level�messagerWr(r(r+r��sx
�
�



$




r�)PZ
__future__rrrr�Z
__metaclass__r�rr�r#r�rr�r!ryZansiblerr�Zansible.errorsrrrr	r
rZansible.executor.task_resultrZansible.executor.module_commonr
Z)ansible.module_utils.parsing.convert_boolrZansible.module_utils.sixrZansible.module_utils._textrrZansible.module_utils.connectionrZansible.playbook.conditionalrZansible.playbook.taskrZansible.pluginsrZansible.plugins.loaderrrrrrrZansible.templaterZansible.utils.collection_loaderrrZansible.utils.listifyrZansible.utils.unsafe_proxyr r!Zansible.vars.cleanr"r#Zansible.utils.displayr$Zansible.utils.varsr%r&r_ZMAGIC_VARIABLE_MAPPINGr=ZRETURN_VARS�__all__�
BaseExceptionr/r5r7r.r�r(r(r(r+�<module>sZ  >

Zerion Mini Shell 1.0