관리-도구
편집 파일: task_include.cpython-39.opt-1.pyc
a �����)g�����������������������@���s����d�dl�mZmZmZ�eZd�dlmZ�d�dl m Z �d�dlmZ�d�dl mZ�d�dlmZ�d�dlmZ�dgZe��ZG�d d��de�ZdS�) �����)�absolute_import�division�print_functionN)�AnsibleParserError)�Block)�Task)�Display)�Sentinel�TaskIncludec�����������������������s����e�Zd�ZdZed�Zed�Ze�e�Zed�Z d��fdd� Z eddd ��Zd d��Z ��fdd �Zd��fdd� Z��fdd�Zdd��Z���ZS�)r ���z� A task include is derived from a regular task to handle the special circumstances related to the `- include: ...` task. )�file�_raw_params)�apply)�action�args�collectionsZdebugger� ignore_errorsZloopZloop_controlZ loop_with�nameZno_log�registerZrun_once�tags�timeout�vars�whenNc��������������������s ���t�t|��j|||d��d|�_d�S�)N��block�role�task_includeF)�superr ����__init__�statically_loaded)�selfr���r���r����� __class__���A/usr/lib/python3.9/site-packages/ansible/playbook/task_include.pyr���0���s����zTaskInclude.__init__c�����������������C���s*���t�|||d�}|�|j|�||d�|��}|S�)Nr���)�variable_manager�loader)r ���� check_optionsZ load_data)�datar���r���r���r$���r%���Zti�taskr"���r"���r#����load4���s�����zTaskInclude.loadc�����������������C���s����t�|j����}|�|�j�}|rJ|jtjv�rJtd|jd� t |��f�|d��|j�d�s�|j�dd�|jd<�|jd�s�td|j���|j�di��}|r�|jtj vr�td |j�|d��nt|t�s�td t|��|d��|S�)aV�� Method for options validation to use in 'load_data' for TaskInclude and HandlerTaskInclude since they share the same validations. It is not named 'validate_options' on purpose to prevent confusion with '_validate_*" methods. Note that the task passed might be changed as a side-effect of this method. zInvalid options for %s: %s�,��objr���r���NzNo file specified for %sr ���zInvalid options for %s: applyz,Expected a dict for apply but got %s instead)� frozensetr����keys� difference� VALID_ARGSr����CZ'_ACTION_ALL_PROPER_INCLUDE_IMPORT_TASKSr����join�list�get�popZ_ACTION_INCLUDE_TASKS� isinstance�dict�type)r���r(���r'���Zmy_arg_namesZbad_opts�apply_attrsr"���r"���r#���r&���>���s���� zTaskInclude.check_optionsc��������������������sz���t�t|���|�}t|�����|�j�}|D�]L}||�tur(|d�tj v�r(tj rftd||�jj f�|d��q(t�d|���q(|S�)Nr���z&'%s' is not a valid attribute for a %sr+���zIgnoring invalid attribute: %s)r���r ����preprocess_data�setr.���r/����VALID_INCLUDE_KEYWORDSr ���r1���Z_ACTION_ALL_INCLUDE_ROLE_TASKSZINVALID_TASK_ATTRIBUTE_FAILEDr���r!����__name__�displayZwarning)r���Zds�diff�kr ���r"���r#���r:���Y���s����zTaskInclude.preprocess_dataFc��������������������s ���t�t|��j||d�}|�j|_|S�)N)�exclude_parent� exclude_tasks)r���r ����copyr���)r���rA���rB���Znew_mer ���r"���r#���rC���g���s����zTaskInclude.copyc��������������������sj���|�j�tjvrtt|�����}nJt��}|�jr6||�j���O�}||�jO�}||�j O�}d|v�rX|d=�d|v�rf|d=�|S�)z� We override the parent Task() classes get_vars here because we need to include the args of the include into the vars as they are params to the included tasks. But ONLY for 'include' r���r���) r���r1���Z_ACTION_INCLUDEr���r ����get_varsr7����_parentr���r���)r���Zall_varsr ���r"���r#���rD���l���s���� zTaskInclude.get_varsc�����������������C���sD���|�j��di��}|r<g�|d<�tj||�jj|�|�j|�j|�jd�}n|�}|S�)z{ This method is used to create the parent block for the included tasks when ``apply`` is specified r ���r���)Zplayr���r���r$���r%���) r���r5���r���r)���rE���Z_playZ_roleZ_variable_managerZ_loader)r���r9���Zp_blockr"���r"���r#����build_parent_block����s����� zTaskInclude.build_parent_block)NNN)NNNNN)FF)r=���� __module__�__qualname__�__doc__r-���ZBASEZ OTHER_ARGS�unionr0���r<���r����staticmethodr)���r&���r:���rC���rD���rF���� __classcell__r"���r"���r ���r#���r ���"���s��� )Z __future__r���r���r���r8���Z __metaclass__Zansible.constantsZ constantsr1���Zansible.errorsr���Zansible.playbook.blockr���Zansible.playbook.taskr���Zansible.utils.displayr���Zansible.utils.sentinelr ����__all__r>���r ���r"���r"���r"���r#����<module>���s���