%PDF- %PDF-
Mini Shell

Mini Shell

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

a

�)g���@s(ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZddlmZmZmZmZdd	lmZdd
lm Z ddl!m"Z"ddl#m$Z$dd
l%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z;ddl<m=Z=ddl>m?Z?ddl@mAZAddlBmCZCddlDmEZEmFZFddlGmHZHmIZIe?�ZJdgZKeLd�ZMGdd �d �ZNeN�ZOd!d"�ZPd#d$�ZQd%d&�ZRd'd(�ZSGd)d�d�ZTGd*d+�d+eU�ZVGd,d-�d-ejW�ZXdS).�)�absolute_import�division�print_functionN)�deque)�Lock)�UndefinedError)�	constants)�context)�AnsibleError�AnsibleFileNotFound�AnsibleUndefinedVariable�AnsibleParserError)�action_write_locks)�IteratingStates)�
WorkerProcess)�
TaskResult)�CallbackSend�DisplaySend)�string_types)�to_text)�
Connection�ConnectionError)�Conditional)�Handler)�load_list_of_blocks)�Task)�TaskInclude��loader)�Templar)�Display)�add_internal_fqcns)�wrap_var)�combine_vars�isidentifier)�strip_internal_keys�module_response_deepcopy�StrategyBase)Zdiscovered_interpreter_c@seZdZdS)�StrategySentinelN)�__name__�
__module__�__qualname__�r,r,�E/usr/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.pyr(Gsr(cCs�d}|jr\|j|d��6t|jd�}|j|_|�||j�|d<Wd�n1sR0Y|jr�|j|d��J|dur�t|jd�}|j|_|�||j�}||d<|d<Wd�n1s�0YdS)N)�available_variablesr�changed�failed_when_result�failed)Zchanged_whenZset_temporary_contextr�_loader�when�evaluate_conditionalr.Zfailed_when)�result�task�templar�	task_varsZcondr0r,r,r-�post_process_whensNs0r9cCs~i}|js|jrz|�dd�}|�d�}||vr:||||<|rR||vrR||||<d|vrf|d|d<d|vrz|d|d<|S)NZansible_loop_var�itemZansible_index_varZ_ansible_item_labelZansible_loop)�loop�	loop_with�get)r5r6�	item_varsZloop_varZ	index_varr,r,r-�_get_item_vars_s
r?c	Cs(z�|j��}t|t�rW�q$n�t|t�r>tj|ji|j��n�t|t�r�|jD]}t|t	�rN|�
|�qlqN|jj|j
g|j�Ri|j��n^t|t	�r�|�
|�|j�|j�|�Wd�q�1s�0Ynt�dt|�|f�Wqttf�yY�q$Yqtj�y Yq0qdS)Nz7Received an invalid object (%s) in the result queue: %r)�_final_qr=�
isinstancer(r�display�args�kwargsrr�normalize_task_result�_tqm�
send_callbackZmethod_name�
_results_lock�_results�append�warning�type�IOError�EOFError�queueZEmpty)�strategyr5�argr,r,r-�results_thread_mainos*






"

,
rRcst���d�fdd�	�}|S)zVClosure to wrap ``StrategyBase._process_pending_results`` and invoke the task debuggerFNc	s�d}|j��}�||||d�}g}|D�]�}|j}	|j}
|j�|
j|	jfd�}|d}|d}
z||
j}Wnty�|�	|
�}Yn0|j
|jd��r�t�}t
|	|
||
||�}|��|jtjk�r�|j��|	j�r0|jjtd�v�r0|���r0|��D]0\}}||
jk�rq�|�||�|jj�|�q�|�|
j|�|D]*\}}t||���rB|jj�||
j��qB|jj�d|
j�|�|
|	||
�|� t!��|||��q&q�|jtj"k�r�|�#|�q&q�|jtj$kr�t%�&d�q�|�#|�q&|S)	N))�	is_failed�failures)�is_unreachable�dark)�
is_changedr/)�
is_skipped�skipped)�one_pass�
max_passesr8�play_context)Zglobally_enabled)Zlinear�ok�c)'Zhost_states�copy�_task�_host�_queued_task_cache�pop�name�_uuid�KeyErrorZget_host_stateZneeds_debugger�debugger_active�
NextAction�Debugger�cmdloopr5�REDOrFZclear_failed_hosts�run_once�_playrPr!rS�itemsZset_state_for_host�_removed_hosts�remove�getattr�_statsZ	decrement�_queue_task�extend�
debug_closure�CONTINUErJ�EXIT�sys�exit)�self�iteratorrZr[Zstatus_to_stats_mapZprev_host_states�resultsZ_processed_resultsr5r6�hostZ_queued_task_argsr8r\Zprev_host_state�next_actionZdbg�	host_name�state�methodZwhat��funcr,r-�inner�sR


$
zdebug_closure.<locals>.inner)FN)�	functools�wraps)r�r�r,r�r-ru�s=ruc@s�eZdZdZdZdd�Zd0dd�Zdd�Zd1d
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zed2dd��Zd d!�Zd"d#�Zd3d$d%�Zd4d&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)5r'z�
    This is the base class for strategy plugins, which contains some common
    code useful to all strategies like running handlers, cleanup actions, etc.
    TcCs�||_|��|_|j|_|��|_|��|_|j|_t	j
�dd�|_t	j
�dd�|_
i|_t|_d|_d|_t�|_t�|_t�t���|_tjt|fd�|_d|j_|j��t�|_ g|_!g|_"t#j$|_%dS)N�stepF�diffr)�targetrCT)&rFZ
get_inventory�
_inventory�_workersZget_variable_manager�_variable_manager�
get_loaderr2r@r	ZCLIARGSr=�_step�_diffrbrBZ_display�_pending_results�_cur_worker�dict�_blocked_hostsrrI�	threading�	ConditionrrH�ThreadrR�_results_thread�daemon�start�_active_connections�_hosts_cache�_hosts_cache_all�CZENABLE_TASK_DEBUGGERrg)rzZtqmr,r,r-�__init__�s,



zStrategyBase.__init__cCs~|st|j|jf�rdS|js4td��|j�r4d}n
|jp<d}dd�|jj|dd�D�|_dd�|jj|j|j	d�D�|_dS)	z�Responsible for setting _hosts_cache and _hosts_cache_all

        See comment in ``__init__`` for the purpose of these caches
        N�allcSsg|]
}|j�qSr,�rd��.0�hr,r,r-�
<listcomp>�z1StrategyBase._set_hosts_cache.<locals>.<listcomp>T)�patternZignore_restrictionscSsg|]
}|j�qSr,r�r�r,r,r-r�r�)�order)
r�r�r�Z	finalizedr�is_template�hostsr��	get_hostsr�)rz�play�refreshZ_patternr,r,r-�_set_hosts_caches
zStrategyBase._set_hosts_cachecCsr|j��D]L}zt|�}|��Wq
tyT}zt�d|�WYd}~q
d}~00q
|j�t	�|j
��dS)N�4got an error while closing persistent connection: %s)r��valuesr�resetrrB�debugr@Zput�	_sentinelr��join)rzZsockZconn�er,r,r-�cleanups&zStrategyBase.cleanuprc	Cs�|jD]L}||jjvrz|�|jj|�WqtyP|�|j�|��Yq0qt|t	�sn||jj
krn|St|jj���dkr�|jj
St|���dkr�|jjS|jj
SdS)Nr)r�rF�_unreachable_hosts�get_next_task_for_hostr�r�rf�get_hostrA�boolZRUN_OK�len�keysZRUN_UNREACHABLE_HOSTS�get_failed_hostsZRUN_FAILED_HOSTS)rzr{r\r5r}r,r,r-�run!s
zStrategyBase.runcs8|j|dd�t|jj��|jj���fdd�|jD�S)NF�r�csg|]}|�vr|�qSr,r,�r�r}��ignorer,r-r�;r�z4StrategyBase.get_hosts_remaining.<locals>.<listcomp>)r��setrF�
_failed_hosts�unionr�r��rzr�r,r�r-�get_hosts_remaining8sz StrategyBase.get_hosts_remainingcs"�j|dd��fdd��jD�S)NFr�csg|]}|�jjvr|�qSr,)rFr�r��rzr,r-r�?r�z1StrategyBase.get_failed_hosts.<locals>.<listcomp>)r�r�r�r,r�r-r�=szStrategyBase.get_failed_hostscCs |�|�|d<|�|�|d<dS)z�
        Base class method to add extra variables/information to the list of task
        vars sent through the executor engine regarding the task queue manager state.
        Zansible_current_hostsZansible_failed_hostsN)r�r�)rz�varsr�r,r,r-�add_tqm_variablesAszStrategyBase.add_tqm_variablesc
CsTt�d|j|jf�|jtjvr@t�d|j�t�tj|j<t|j|d�}zt|�	|j
��}Wn4ty�}ztd|j
|d��WYd}~n
d}~00�zbt|j�}|dkr�|jr�|jr�t�d|���n"||kr�t�d	|��|f�|}d
}	|j}
|j|k�rd|_|j|j}|du�s,|���s�||||d�|j|j|jf<t|j|||||j|jt�}||j|j<|j�d||�|��t�d
|jdt|j�f�d}	|jd7_|j|k�r�d|_|	�r֐q�q�|j|
kr�t�d�q�|j d7_ Wn<t!t"t#f�y8}zt�d|�WYd}~dSd}~00t�d|j|jf�dS)z5 handles queueing the task up to be sent to a worker z entering _queue_task() for %s/%szCreating lock for %s�r�	variablesz3Failed to convert the throttle value to an integer.)�objZorig_excNrz6Ignoring 'throttle' as 'run_once' is also set for '%s'ztask: %s, throttle: %dF)r}r6r8r\Zv2_runner_on_startz"worker is %d (out of %d available)�Tg-C��6?zgot an error while queuing: %szexiting _queue_task() for %s/%s)$rBr�rd�actionrrrr2�int�template�throttle�	Exceptionr
�_dsr�r��ALLOW_BASE_THROTTLINGrl�get_namer��is_aliverbrerr@r��
plugin_loaderrFrGr��time�sleepr�rNrM�AssertionError)rzr}r6r8r\r7r�r�Zrewind_pointZqueuedZstarting_workerZ
worker_prcr,r,r-rsIs\
&
�
zStrategyBase._queue_taskcs(|jr�fdd��jD�}n|jg}|S)Ncsg|]}|�jjvr|�qSr,)rFr�r�r�r,r-r��r�z/StrategyBase.get_task_hosts.<locals>.<listcomp>)rlr�rd)rzr{Z	task_hostr6�	host_listr,r�r-�get_task_hosts�szStrategyBase.get_task_hostscCs |�di��dd�}|p|jgS)NZ_ansible_delegated_varsZansible_delegated_host)r=�delegate_to)rzr5r6rr,r,r-�get_delegated_hosts�sz StrategyBase.get_delegated_hostscs�|jdurdS|d}t���j}|D] }tD]}|�|�r.||�q.q&�r�|j�dt��fdd�t|�D��i}|�||�}|j	j
}	|D]}
|	|
|�q�dS)z�Sets host facts for ``delegate_to`` hosts for facts that should
        always be delegated

        This operation mutates ``result`` to remove the always delegated facts

        See ``ALWAYS_DELEGATE_FACT_PREFIXES``
        N�
ansible_factsc3s"|]}|�vr|�|�fVqdS�Nr,)r��k�Z_popZalways_keysr,r-�	<genexpr>�r�z;StrategyBase._set_always_delegated_facts.<locals>.<genexpr>)r�r��add�ALWAYS_DELEGATE_FACT_PREFIXES�
startswithrcr��listr�r��set_host_facts)rzr5r6ZfactsZ_addZfact_keyZ
always_keyZalways_factsr�Z_set_host_facts�target_hostr,r�r-�_set_always_delegated_facts�s"

�z(StrategyBase._set_always_delegated_factscCs�t|jt�r |j�t|j��|_t|jt�r�|jj|jf}z|j|d}Wn*t	yv|j
�d�dkrl�t�}Yn0|j
ddd�}|j|_|�|j
�||_|S)aLNormalize a TaskResult to reference actual Host and Task objects
        when only given the ``Host.name``, or the ``Task._uuid``

        Only the ``Host.name`` and ``Task._uuid`` are commonly sent back from
        the ``TaskExecutor`` or ``WorkerProcess`` due to performance concerns

        Mutates the original object
        r6r�Zasync_statusT)�exclude_parentZ
exclude_tasks)rArarr�r�rr`rdrbrf�_task_fieldsr=rr_�_parentZ
from_attrs)rz�task_resultZqueue_cache_entryZ
found_task�
original_taskr,r,r-rE�s
z"StrategyBase.normalize_task_resultFNc,
s�g}t�j�����fdd�}d}zLz�j���j��}Wn$ty`YW�j���q�Yn0W�j��n�j��0|j}|j	�d}	|�
��rd}	�j}
|
�s���|j
�}t�d|j
��jr��j��jj�D]}|j
�jjvr؈�|�q�n
��|��j|dd�\}
}��
|��rB|
�rB|
jtjk�rBd�jj|j
<��|��r��jj�d|j
��jj �!|j
��j"�#|j
t$t%��&��|j'd	��n�jj�d
|j
�nN�jj�d|j
��jj�d|j
�d
|j'v�r�|j'd
�r��jj�d
|j
��jj(d||
d��np|�)��r��j*}|�sTd�jj|j
<�jj �+|j
��jj�d|j
�n$�jj�d|j
��jj�d|j
��j�(d|��n�|�,��r��jj�d|j
��j�(d|��n�d}	�j-�r�|j'�.dg�}n|j'g}|D�]}d|v�r�|�/��r�|dD]�}d}||�jj0�}|du�rBd}|�1|��rB�j�(d||��jj0D]x}|j2D]j}t3|dg��phg}|�st�qT|�4d|j5�.d�|��}||v�r��qTnd}|�1|��rT�j�(d||��qT�qJ|�sd|}t6j7�r�t8|��n
t�9|��qd|v�rF|�.dt$��}�j�:||�|�.d
��r^|d�j;v�r^�j;�+|d�nd|v�r^�j�<||�d|v�srd|v�r*t=|��}�j>�.|j
|j	j?f�d}|�r�t@||�}n|}t%|�|�jA<tB|��|��j-�s؈jC�r*tD|j|j	||jE�}�j�(d|�|�.d
d��rd|j'd
<|�.dd��r*d|j'd<d |v�r$�jFt6jGv�r$�jHdu�rd�jI�rd��J|��}n��K|����L�|��}�jFt6jMv�r�|d �N�D]&\}} |D]}!�j"�O|!|| ��q��q�nb|�Pd!d�}"|D]P}!�jFt6jQv}#|#�r�|"�r�j"�R|!|d �S��|#�r҈j"�#|!|d �S���q�d"|v�r�d#|d"v�r�|d"d#�r�d$|d"v�sf|d"d$�rv��L�|��}ndg}|d"d#}$d%|d"v�o�|d"d%}%|D]J}&|$�T�D]:}'|%�rԈjj�U|'|$|'|&�n�jj�V|'|$|'|&��q��q��q�d&|j'v�r&�jW�st3�d&d��r&�j�(d'|�tX�tY��sn�jj�d|j
�d
|j'v�rn|j'd
�rn�jj�d
|j
��j�(d(|��jA�r�tZ�jA��s�t8d)�jA����L�|��}t[t\|j'��}(d*|(v�r�|(d*=|D]}!�j"�#|!�jA|(i��qΈj]d+8_]|j
�j^v�r�j^|j
=�j_du�r`|	�r`�jj`�j_�a��N�D]&\})}*|*j?�j_j?k�r8d|*jb|j
<�q8|�+|�tX�tc��r��fd,d-��jj0D�D]}+|+�d|��q�|�s�|du�r�|d+|k�r��q�|d+7}q"|S).z�
        Reads results off the final queue and takes appropriate action
        based on the result (executing callbacks, updating state, etc.).
        cs�t|�D]�}|jD]�}|jrzx|js`��|j�rZ�jj�j|�j�j	d��_
��|j�|_d|_|j|jdd�|jdd�f}||vr�|WSWqt
tfy�}z6|js�t�d|jt|�f�WYd}~qWYd}~qd}~00qqdS)N)r�r6�_hosts�
_hosts_allTF)Zinclude_role_fqcnz�Handler '%s' is unusable because it has no listen topics and the name could not be templated (host-specific variables are not supported in handler names). The error: %s)�reversed�blockrdZcached_namer�r��get_varsrmr�r�r.r�r�rr�listenrBrKr)�handler_nameZhandler_blocksZ
handler_blockZhandler_taskZ
candidatesr�)�handler_templarr{rzr,r-�search_handler_blocks_by_name�s6

�

���zLStrategyBase._process_pending_results.<locals>.search_handler_blocks_by_namerFTzmarking %s as failed)�peekZrescued)Zansible_failed_taskZansible_failed_resultrTr]Zignoredr/�v2_runner_on_failed)�
ignore_errorsrVZv2_runner_on_unreachablerY�v2_runner_on_skippedr|Z_ansible_notifyNZv2_playbook_on_notifyr�zlThe requested handler '%s' was not found in either the main handlers list nor in the listening handlers listZadd_hostr�	add_groupr8Zv2_runner_item_on_okr1r�Z_ansible_facts_cacheableZ
ansible_stats�dataZper_host�	aggregater�Zv2_on_file_diffZv2_runner_on_okz3Invalid variable name in 'register' specified: '%s'Z
invocationr�c3s*|]"}|jD]}|j�jkr|VqqdSr�)r�re)r��br�)r�r,r-r�r�z8StrategyBase._process_pending_results.<locals>.<genexpr>)err2rH�acquirerI�popleft�
IndexError�releaserar`rSr��get_state_for_hostrdrBr�rlr�r�rmr�rFr�Zmark_host_failedr��	run_stater�COMPLETEr�Zis_any_block_rescuingrr�	incrementrorpr�Zset_nonpersistent_factsr�r"Z	serialize�_resultrGrU�ignore_unreachablerJrXr;r=rW�handlersZnotify_hostr�rqZget_validated_valueZfattributesr�ZERROR_ON_MISSING_HANDLERr
rKZadd_dynamic_hostr�Zadd_dynamic_groupr?rbrer#�registerr9r<rr�r�Z
_ACTION_DEBUGr�Zdelegate_factsr�r�r�Z_ACTION_INCLUDE_VARSrnZset_host_variablercZ_ACTION_SET_FACTr�r_r�Zupdate_custom_statsZset_custom_statsr�rArr$r%r&r�r��_roleZ
ROLE_CACHEr��
_had_task_runr�remove_host),rzr{rZr[�ret_resultsr�Zcur_passr�Z
original_hostZrole_ranr�Zstate_when_failedr�r��_r
Zresult_itemsZresult_itemr��foundZtarget_handlerZlistening_handler_blockZlistening_handlerZ	listeners�msgZ
new_host_infor>Zfound_task_varsZ
all_task_varsZnew_item_resultr�Zvar_nameZ	var_valuer�Z	cacheableZis_set_factr�r�Zmyhostr�Z
clean_copy�entryZrole_objZhandlerr,)r�r{r�rzr-�_process_pending_results�sb
(

�

 
��






�
�



�

&"



z%StrategyBase._process_pending_resultscCslg}t�d�|jdkr^|jjs^|j��r2td��|�|�}|�|�|jdkrt	�
tj�qt�d�|S)z�
        Wait for the shared counter to drop to zero, using a short sleep
        between checks to ensure we don't spin lock
        zwaiting for pending results...rz"A worker was found in a dead statez/no more pending results, returning what we have)
rBr�r�rFZ_terminatedZhas_dead_workersr
rrtr�r�r�ZDEFAULT_INTERNAL_POLL_INTERVAL)rzr{rr|r,r,r-�_wait_on_pending_resultss





z%StrategyBase._wait_on_pending_resultscCs.|jjdd�}|jj|_|j|jB}||_|S)zW
        A proven safe and performant way to create a copy of an included file
        T)r�)r`r_r�r�Z_vars)rz�
included_file�ti_copyZ	temp_varsr,r,r-�_copy_included_file/s

z StrategyBase._copy_included_filecCsjt�d|j�z~|j�|j�}|dur.gWSt|t�s@td��|�|�}t	||j
|��|jj
||j|jd�}|jD]}|jj�d|j�qtWn�ty��Yn�t�yL}z�t|t�r�dt|j�}	nt|�}	|jD]}
d|
jd<q�|jD]<}t||jtd|	d	�d
�}|jj�d|j�|j�d|�q�t|	�|�WYd}~n
d}~00|j�d
|�t�d�|S)a4
        Loads an included YAML file of tasks, applying the optional set of variables.

        Raises AnsibleError exception in case of a failure during including a file,
        in such case the caller is responsible for marking the host(s) as failed
        using PlayIterator.mark_host_failed().
        zloading included file: %sNz0included task files must contain a list of tasks)r�Zparent_blockZroleZuse_handlersrZvariable_managerr]z8Could not find or access '%s' on the Ansible Controller.Tr1)r1�reason)r}r6Zreturn_datarTr�Zv2_playbook_on_includezdone processing included file)rBr�Z	_filenamer2Zload_from_filerAr�r
rrrmZbuild_parent_blockr`r
r�r�rFrrrrdr
rr�	file_namerIr	rr�rG)rzrr{Z
is_handlerr�rZ
block_listr}r�r�r�trr,r,r-�_load_included_file<sF

�



 
z StrategyBase._load_included_filecCs�d}d|}|r|d|7}|d7}t�|�}|��dvrJt�d�d}n,|��dvrlt�d	�d|_d}n
t�d
�t�|�|S)NFzPerform task: %s zon %s z(N)o/(y)es/(c)ontinue: )�yZyesz
User ran taskT)�c�continuez$User ran task and canceled step modezUser skipped task)rB�prompt�lowerr�r�Zbanner)rzr6r}�retrZrespr,r,r-�
_take_steprs 




zStrategyBase._take_stepcCst�d|�dS)Nz)%s task does not support when conditional)rBrK)rzZ	task_namer,r,r-�_cond_not_supported_warn�sz%StrategyBase._cond_not_supported_warnc
s�j�d�}���fdd�}d}|}d|}	t�t�rF�j�d��n�jjd�dd�|d	vrp�jrp��|�|d
kr�d
}�n�|dkr�||�rڈ�|j	�}
|
j
tjkr�t
d��|j	�jjvr�|
j
|
_tj|
_
d
|j	}nd}|	d|j	7}	�n�|dk�r�j�����j�d}�n^|dk�rt||��r^�j��jj�D]}|��}�j�|��q<d}nd}|	d|j	7}	�n|dk�r�||��rԈj��jj�D]4}�jj�|j	d��jj�|j	d���|��q�d}nd}|	d|j	7}	�n�|dk�rL||��r<�j��jj�D]&}|j	�jjv�r��|j	tj��qd}nd}|	d7}	�n*|dk�r�||��r��j��jj�D],}|j	�jjv�rp��|j	tj�d�_�qpd}nd}|	d7}	�n�|dk�r||��r��|j	tj��jj� |j	�d|j	}nd}|	d |j	7}	d!|j	}�nb|d"k�rR�j!�rv|j	�j"j#v�rvd�j"j$|j	<d#|j	}�n$|d$k�rd�jj%�j|��j&�j'd%�}
t(�j)|
d&�}|j*�|
|d'�}|j+|d(�|j,�s�|j-|_,|�.|
�|�j/v�r�t0�j/|�}�j/|=n0t1j2�|j3|t4j5�}|j6��7�|
d)�|�8|�|�r^z|�9�d*}Wn4t:�yZ}zt;�<d+|�WYd}~n
d}~00nd,}nt
d-|�j=d.��d/|i}|�r�d|d0<|	|d1<nd|d2<�j!�s�|�r�|	n|}t;�>d3|���t�t��rڈ�?|�t@|�|�}|�r��j�d4|�|gS)5NZ_raw_paramscs6�jj�j|��j�jd�}t�j|d�}��||�S)N�r�r}r6r�r�r�)r�r�rmr�r�rr2r4)r��all_varsr7�r{rzr6r,r-�_evaluate_conditional�s
�z9StrategyBase._execute_meta.<locals>._evaluate_conditionalFz!%s conditional evaluated to FalseZ!v2_playbook_on_handler_task_startZv2_playbook_on_task_start)Zis_conditional)�noop�refresh_inventory�reset_connectionr+Zflush_handlersz*flush_handlers cannot be used as a handlerz!triggered running handlers for %sTz, not running handlers for %sr,z inventory successfully refreshed�clear_factsz
facts clearedz*, not clearing facts and fact cache for %s�clear_host_errorszcleared host errorsz&, not clearing host error state for %sZ	end_batchzending batchz, continuing current batch�end_playzending playz, continuing playZend_hostzending play for %sz, continuing execution for %szDend_host conditional evaluated to false, continuing execution for %sZ
role_completezrole_complete for %sr-r'r�)r6r�r7)r7)Z	task_keysZvar_optionszreset connectionr�zno connection, nothing to resetz!invalid meta action requested: %s)r�rrY�skip_reasonr/zMETA: r�)ArCr=rArrFrGr3r&rrdrrZHANDLERSr
r�Zpre_flushing_run_stater�r,r�rmr�r�r�r�r.r�rcr/Zset_run_state_for_hostrr0rorJZimplicitr
rZ
_completedr�r�r�rr2Zset_task_and_variable_override�
post_validateZremote_addr�addressZupdate_varsr�rr�Zconnection_loader�
connection�os�devnullZset_optionsZ
dump_attrsZset_attributes_from_pluginr�rrBr�r�Zvvrr)rzr6r\r{r�Zmeta_actionr*rYrr1Z
host_stater}�hostnamer(r7r4r�r5�header�resr,r)r-�
_execute_meta�s�
















�


&

zStrategyBase._execute_metac	Cs\g}|jD]L}||jjvr
z|�|jj|�Wq
tyT|�|j�|��Yq
0q
|S)zQ returns list of available hosts for this iterator by filtering out unreachables )r�rFr�rJr�r�rfr�)rzr{Z
hosts_leftr}r,r,r-�get_hosts_left.s
zStrategyBase.get_hosts_leftcCsD|D]:}d|jvr|jd�d�}|r|j|jvr||j|j<qdS)z3 updates the current active persistent connections rCZ_ansible_socketN)r�r=rar�)rzr|rZsocket_pathr,r,r-�update_active_connections:s
z&StrategyBase.update_active_connections)T)r)FN)F)N)r)r*r+�__doc__r�r�r�r�r�r�r�r�rsr�r�r�rErurrrrr%r&r:r;r<r,r,r,r-r'�s6.

S"4
6
#c@s(eZdZdZdZdZdZefdd�ZdS)rhz. The next action after an interpreter's exit. r���cCs
||_dSr�)r5)rzr5r,r,r-r�JszNextAction.__init__N)r)r*r+r=rkrvrwr�r,r,r,r-rhDs
rhc@s�eZdZdZdd�Zdd�ZejjZ	dd�Z
dd	�ZeZd
d�Z
e
Zdd
�ZeZdd�ZeZdd�Zdd�ZeZdd�Zdd�ZdS)riz> cCsbtj�|�d||f|_d|_i|_||jd<||jd<||jd<||jd<||jd<||_dS)Nz[%s] %s (debug)> r6r8r}r\r5)�cmd�Cmdr�r"Zintro�scoper~)rzr6r}r8r\r5r~r,r,r-r�Qs




zDebugger.__init__cCs(ztj�|�Wnty"Yn0dSr�)r@rArj�KeyboardInterruptr�r,r,r-rj_szDebugger.cmdloopcCs
|�|�S)�Quit)�do_quit�rzrCr,r,r-�do_EOFgszDebugger.do_EOFcCst�d�tj|j_dS)rDzUser interrupted executionT)rBrhrwr~r5rFr,r,r-rEks

zDebugger.do_quitcCstj|j_dS)zContinue to next resultT)rhrvr~r5rFr,r,r-�do_continuess
zDebugger.do_continuecCstj|j_dS)zKSchedule task for re-execution. The re-execution may not be the next resultT)rhrkr~r5rFr,r,r-�do_redozs
zDebugger.do_redocCs@td|jdd�}|jd}|�|j�}|�|�||jd<dS)zLRecreate the task from ``task._ds``, and template with updated ``task_vars``Nr8)r�r6)rrBZ	load_datar�r2)rzrCr7r6r,r,r-�do_update_task�s


zDebugger.do_update_taskc	Cslzt|t�|j�WStyft��dd�\}}t|t�rD|}n|j}t	�	d|t
|�f��Yn0dS)Nr>�***%s:%s)�eval�globalsrBr�rx�exc_inforA�strr)rB�repr)rzrC�t�v�
exc_type_namer,r,r-�evaluate�s
zDebugger.evaluatecCs6z|�|�}t�t�|��Wnty0Yn0dS)zPretty PrintN)rTrB�pprintZpformatr�)rzrCr5r,r,r-�	do_pprint�s

zDebugger.do_pprintc	Cs~z$t|ddd�}t|t�|j�WnTtyxt��dd�\}}t|t�rV|}n|j	}t
�
d|t|�f��Yn0dS)N�
z<stdin>Zsingler>rK)�compile�execrMrBr�rxrNrArOr)rBrP)rzrC�coderQrRrSr,r,r-�execute�s
zDebugger.executecCs&z|�|�Wnty Yn0dSr�)r[r�)rz�liner,r,r-�default�szDebugger.defaultN)r)r*r+Zprompt_continuousr�rjr@rAZdo_helpZdo_hrGrEZdo_qrHZdo_crIZdo_rrJZdo_urTrVZdo_pr[r]r,r,r,r-riNs$
ri)YZ
__future__rrrrLZ
__metaclass__r@r�r5rUrOrxr�r��collectionsrZmultiprocessingrZjinja2.exceptionsrZansiblerr�r	Zansible.errorsr
rrr
Zansible.executorrZansible.executor.play_iteratorrZansible.executor.process.workerrZansible.executor.task_resultrZ#ansible.executor.task_queue_managerrrZansible.module_utils.sixrZansible.module_utils._textrZansible.module_utils.connectionrrZansible.playbook.conditionalrZansible.playbook.handlerrZansible.playbook.helpersrZansible.playbook.taskrZansible.playbook.task_includerZansible.pluginsrr�Zansible.templaterZansible.utils.displayr Zansible.utils.fqcnr!Zansible.utils.unsafe_proxyr"Zansible.utils.varsr#r$Zansible.vars.cleanr%r&rB�__all__�	frozensetr�r(r�r9r?rRrur'�objectrhrArir,r,r,r-�<module>sjC~

Zerion Mini Shell 1.0