관리-도구
편집 파일: playbook_include.cpython-39.opt-1.pyc
a �����)g�����������������������@���s����d�dl�mZmZmZ�eZd�dlZd�dlmZ �d�dl mZmZ�d�dl mZ�d�dlmZ�d�dlmZmZ�d�dlmZmZ�d�dlmZ�d�d lmZ�d�d lmZ�d�dlmZ�d�dlm Z �d�d l!m"Z"m#Z#�d�dl$m%Z%�d�dl&m'Z'�e'��Z(G�dd��deee�Z)dS�)�����)�absolute_import�division�print_functionN)�AnsibleParserError�AnsibleAssertionError)�to_bytes)�string_types)� split_args�parse_kv)�AnsibleBaseYAMLObject�AnsibleMapping)�NonInheritableFieldAttribute)�Base)�Conditional)�Taggable)�AnsibleCollectionConfig)�_get_collection_name_from_path�_get_collection_playbook_path)�Templar)�Displayc�����������������������sX���e�Zd�Zedd�Zededd�Zeddd��Zd��fd d � Z ��fdd�Z d d��Z���ZS�)�PlaybookInclude�string)�isa�dict�vars)r����default�aliasNc�����������������C���s���t���j|�|||d�S�)N)�ds�basedir�variable_manager�loader)r���� load_data)�datar���r���r �����r#����E/usr/lib/python3.9/site-packages/ansible/playbook/playbook_include.py�load/���s����zPlaybookInclude.loadc�������������� ������s���ddl�m}�ddlm}�tt|���|||�}|�j���}|rF||� ��O�}t ||d�} ||d�} | �|j�}t |�}|dur�|d�} |d�}n&|} tj�| �s�tj�|| �} t| �}|r�|t_n$tj�tj�tj�t| d d �����| j| ||�j���d��| jD�]�}|j�r$t||��r$|jdd��|_|j|jB�}|�dd�}|du�rX|j �!|�"d ���||_t#t$|j ��%|j ��|_ |j&du��r�tj�| �|_&|jr�|j'|j(�|j)�|j*�D�]$}|jdd��|jdd���|_+�q�q�| S�)z� Overrides the base load_data(), as we're actually going to return a new Playbook() object rather than a PlaybookInclude object r���)�Playbook)�Play)r ���Z variables)r ���N��������Zsurrogate_or_strict)�errors)� file_namer���r����tags�,),Zansible.playbookr&���Zansible.playbook.playr'����superr���r!���r����copyZget_varsr����template�import_playbookr����os�path�isabs�joinr���r���Zdefault_collectionZplaybook_paths�append�dirname�abspathr���Z_load_playbook_dataZ_entriesZwhen� isinstanceZ_included_conditional�popr,����extend�split�list�set�unionZ_included_pathZ pre_tasksZrolesZtasksZ post_tasksZ_when)�selfr���r���r���r ���r&���r'���Znew_objZall_varsZtemplarZpbr+����resourceZplaybookZplaybook_collection�entryZ temp_varsZ param_tagsZ task_block�� __class__r#���r$���r!���3���sH���� $ $zPlaybookInclude.load_datac��������������������s����t�|t�std|t|�f���t��}t�|t�r6|j|_|���D�]`\}}|tj v�rb|�� ||||��q>|dkr�d|v�r�td|d��nt�|t�s�td|d��|||<�q>tt |���|�S�)z� Regorganizes the data for a PlaybookInclude datastructure to line up with what we expect the proper attributes to be z%ds (%s) should be a dict but was a %sr���zTimport_playbook parameters cannot be mixed with 'vars' entries for import statements��objzEvars for import_playbook statements must be specified as a dictionary)r9���r���r����typer���r���Zansible_pos�items�CZ_ACTION_IMPORT_PLAYBOOK�_preprocess_importr���r.���r����preprocess_data)r@���r����new_ds�k�vrC���r#���r$���rK���~���s���� zPlaybookInclude.preprocess_datac�����������������C���sh���|du�rt�d|d��nt|t�s4t�dt|��|d��t|�}t|�dkrTt�d|d��|d����|d<�dS�)zQ Splits the playbook import line up into filename and parameters Nz$playbook import parameter is missingrE���zQplaybook import parameter must be a string indicating a file path, got %s insteadr���z?import_playbook statements must specify the file name to importr1���)r���r9���r���rG���r ����len�strip)r@���r���rL���rM���rN���rH���r#���r#���r$���rJ�������s���� z"PlaybookInclude._preprocess_import)NN)NN) �__name__� __module__�__qualname__r ���r1���r���Zvars_val�staticmethodr%���r!���rK���rJ���� __classcell__r#���r#���rC���r$���r���*���s��� Kr���)*Z __future__r���r���r���rG���Z __metaclass__r2���Zansible.constantsZ constantsrI���Zansible.errorsr���r���Zansible.module_utils._textr���Zansible.module_utils.sixr���Zansible.parsing.splitterr ���r ���Zansible.parsing.yaml.objectsr���r���Zansible.playbook.attributer ���Zansible.playbook.baser���Zansible.playbook.conditionalr���Zansible.playbook.taggabler���Zansible.utils.collection_loaderr���Z2ansible.utils.collection_loader._collection_finderr���r���Zansible.templater���Zansible.utils.displayr���Zdisplayr���r#���r#���r#���r$����<module>���s$���