HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/ansible/playbook/role/__pycache__/definition.cpython-39.pyc
a

�)g�%�@s�ddlmZmZmZeZddlZddlmZ	ddl
mZmZddl
mZddlmZmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddl m!Z!ddl"m#Z#ddl$m%Z%dgZ&e%�Z'Gdd�deeee�Z(dS)�)�absolute_import�division�print_functionN)�	constants)�AnsibleError�AnsibleAssertionError)�string_types)�AnsibleBaseYAMLObject�AnsibleMapping)�NonInheritableFieldAttribute)�Base)�CollectionSearch)�Conditional)�Taggable)�Templar)�AnsibleCollectionRef)�_get_collection_role_path)�unfrackpath)�Display�RoleDefinitioncsteZdZedd�Zd�fdd�	Zeddd��Z�fdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
ddd�Z�ZS)r�string)ZisaNcsDtt|���||_||_||_d|_d|_||_t	�|_
||_dS�N)�superr�__init__�_play�_variable_manager�_loader�
_role_path�_role_collection�
_role_basedir�dict�_role_params�_collection_list)�self�playZrole_basedir�variable_manager�loaderZcollection_list��	__class__��D/usr/lib/python3.9/site-packages/ansible/playbook/role/definition.pyr0szRoleDefinition.__init__cCstd��dS)Nznot implemented)r)�datar%r&r)r)r*�loadAszRoleDefinition.loadcs�t|t�rd|}t|t�s6t|t�s6t|t�s6t��t|t�rPtt|��|�}||_	t
�}t|t�rn|j|_|�|�}|�
|�\}}t|t�r�|�|�\}}||O}||_||d<||_|S)Nz%s�role)�
isinstance�intr rr	rrr�preprocess_data�_dsr
Zansible_pos�_load_role_name�_load_role_path�_split_role_paramsr!r)r#�dsZnew_ds�	role_name�	role_pathZnew_role_def�role_paramsr'r)r*r0Es&




zRoleDefinition.preprocess_datacCslt|t�r|S|�d|�d��}|r.t|t�s:td|d��|jrh|jj|jd�}t|j|d�}|�	|�}|S)z�
        Returns the role name (either the role: or name: field) from
        the role definition, or (when the role definition is a simple
        string), just that string
        r-�namez)role definitions must contain a role name��obj�r$�r&Z	variables)
r.r�getrr�get_varsrrr�template)r#r5r6�all_vars�templarr)r)r*r2rs

zRoleDefinition._load_role_namec	CsV|jdur|jj|jd�}nt�}t|j|d�}|�|�}d}|jsNt�	|�rZt
||j�}|rt|d|_|dd�Stj
�|j��d�g}tjr�|�tj�|jr�|�|j�|�|j���|D]8}|�|�}ttj
�||��}|j�|�r�||fSq�t|�}|j�|��r&tj
�|�}||fS|j�p0g|}td|d�|�f|jd	��dS)
a
        the 'role', as specified in the ds (or as a bare string), can either
        be a simple name or a full path. If it is a full path, we use the
        basename as the role name, otherwise we take the name as-given and
        append it to the default role path
        Nr<r=�rZrolesz!the role '%s' was not found in %s�:r:)rr?rr rrr@r"rZ
is_valid_fqcrrr�os�path�joinZget_basedir�CZDEFAULT_ROLES_PATH�extendr�appendrZpath_exists�basenamerr1)	r#r6rArBZ
role_tupleZrole_search_pathsrFr7Zsearchesr)r)r*r3�s:



�
zRoleDefinition._load_role_pathcCsJt�}t�}t|j�}|��D]"\}}||vr8|||<q|||<q||fS)z�
        Splits any random role params off from the role spec and store
        them in a dictionary of params for parsing later
        )r �	frozensetZfattributes�items)r#r5Zrole_defr8Zbase_attribute_names�key�valuer)r)r*r4�s


z!RoleDefinition._split_role_paramscCs
|j��Sr)r!�copy�r#r)r)r*�get_role_params�szRoleDefinition.get_role_paramscCs|jSr)rrQr)r)r*�
get_role_path�szRoleDefinition.get_role_pathTcCs&|r d�dd�|j|jfD��S|jS)N�.css|]}|r|VqdSrr))�.0�xr)r)r*�	<genexpr>��z*RoleDefinition.get_name.<locals>.<genexpr>)rGrr-)r#Zinclude_role_fqcnr)r)r*�get_name�szRoleDefinition.get_name)NNNNN)NN)T)�__name__�
__module__�__qualname__rr-r�staticmethodr,r0r2r3r4rRrSrY�
__classcell__r)r)r'r*r,s
-D))Z
__future__rrr�typeZ
__metaclass__rEZansiblerrHZansible.errorsrrZansible.module_utils.sixrZansible.parsing.yaml.objectsr	r
Zansible.playbook.attributerZansible.playbook.baserZ!ansible.playbook.collectionsearchr
Zansible.playbook.conditionalrZansible.playbook.taggablerZansible.templaterZansible.utils.collection_loaderrZ2ansible.utils.collection_loader._collection_finderrZansible.utils.pathrZansible.utils.displayr�__all__Zdisplayrr)r)r)r*�<module>s&