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: //lib/python3.9/site-packages/ansible/config/__pycache__/manager.cpython-39.pyc
a

�)g�b�@snddlmZmZmZeZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd	lmZdd
l m!Z!ddl"m#Z#ddl$m%Z%dd
l&m'Z'ddl(m)Z)m*Z*m+Z+edd�Z,edd�Z-ddiZ.dd�Z/d%dd�Z0d&dd�Z1dd�Z2dd�Z3d'dd �Z4d!d"�Z5Gd#d$�d$e6�Z7dS)(�)�absolute_import�division�print_functionN)�
namedtuple)�Mapping�Sequence)�NativeEnvironment)�AnsibleOptionsError�AnsibleError)�to_text�to_bytes�	to_native)�	yaml_load)�string_types)�boolean)�unquote)�AnsibleVaultEncryptedUnicode)�	py3compat)�cleanup_tmp_file�
makedirs_safe�unfrackpath�Pluginz	name type�Settingzname value origin type�lookup)Z_termscCs4d}|r$|d|7}|r$|d|7}|d|7}|S)z& construct entry for requested config �zplugin_type: %s zplugin: %s zsetting: %s �)�plugin_type�plugin_name�config�entryrr�:/usr/lib/python3.9/site-packages/ansible/config/manager.py�
_get_entry%sr!cs�d}d�|r,tj�|�r,tj�t|��r,|�|r8|��}|du�r�|dvrZt|dd�}�n.|dvrnt|�}�n|dkr�t|�}�n|dkr�t	|t
�r�d	d
�|�d�D�}nt	|t�s�d}�n�|dkr�|d
kr�d}|dur�d
}�n�|dk�rt	|t
��rt
|�d�}nd}�n||dv�rzt	|t
��rrt
|�d�}tj�|��sFt|d�dt��}tj||d�}tjt|dd�nd}�n|dk�r�t	|t
��r�|�tj�}t	|t��r��fdd
�|D�}nd}n�|dk�rt	|t
��r�dd
�|�d�D�}t	|t��r�fdd
�|D�}nd}nv|dv�r.t	|t��s�d}nZ|dv�rht	|t
tttttf��rbtt|dd ��}nd!}n t	|t
tf��r�tt|dd ��}|�r�td"|t|�f��t|dd#d$�S)%a return a configuration variable with casting
    :arg value: The value to ensure correct typing of
    :kwarg value_type: The type of the value.  This can be any of the following strings:
        :boolean: sets the value to a True or False value
        :bool: Same as 'boolean'
        :integer: Sets the value to an integer or raises a ValueType error
        :int: Same as 'integer'
        :float: Sets the value to a float or raises a ValueType error
        :list: Treats the value as a comma separated list.  Split the value
            and return it as a python list.
        :none: Sets the value to None
        :path: Expands any environment variables and tilde's in the value.
        :tmppath: Create a unique temporary directory inside of the directory
            specified by value and return its path.
        :temppath: Same as 'tmppath'
        :tmp: Same as 'tmppath'
        :pathlist: Treat the value as a typical PATH string.  (On POSIX, this
            means colon separated strings.)  Split the value and then expand
            each part for environment variables and tildes.
        :pathspec: Treat the value as a PATH string. Expands any environment variables
            tildes's in the value.
        :str: Sets the value to string types.
        :string: Same as 'str'
    rN)r�boolF)�strict)Zinteger�int�float�listcSsg|]}t|����qSr)r�strip��.0�xrrr �
<listcomp>_�zensure_type.<locals>.<listcomp>�,Znone�None�path��basedir)�tmp�temppathZtmppathi�zansible-local-%s)�prefix�dirT)�warnr3Zpathspeccsg|]}t|�d��qS�r0��resolve_pathr(r0rr r+�r,ZpathlistcSsg|]}|���qSr)r'r(rrr r+�r,csg|]}t|�d��qSr7r8r(r0rr r+�r,)�dict�
dictionaryr;)�str�string�surrogate_or_strict��errorsr=z"Invalid type provided for "%s": %sZpassthru)r@Z	nonstring)�osr/�isabs�existsr�lowerrr$r%�
isinstancer�splitrr9r�getpid�tempfileZmkdtemp�atexit�registerr�pathseprrr"�complexrr�
ValueErrorr
)�valueZ
value_type�origin�errmsgr4rr0r �ensure_type1sx 









rQcCs&d|vr|�dt���}t|d|d�S)z& resolve relative or 'variable' paths z{{CWD}}F)�followr1)�replacerA�getcwdr)r/r1rrr r9�sr9cCsPd}|durLtj�|�d}|dvr*d}n"|dvr8d}ntd|t|�f��|S)N���)z.iniz.cfg�ini)z.yamlz.yml�yamlz3Unsupported configuration file extension for %s: %s)rAr/�splitextr	r
)�cfile�ftype�extrrr �get_config_type�sr\cCsHd}|durDz$|j|�dd�|�dd�dd�}WntyBYn0|S)z+ returns the value of last ini entry found N�section�defaults�keyrT)�raw)�get�	Exception)�prrNrrr �get_ini_config_value�s$rdc
CsB|durt�}t}g}t�d|�}||ur^t|dd�}tj�t|��rTtj�|d�}|�	|�d}zTt�
�}t�|�}tj�|d�}|jtj
@r�tj�|�r�d}n|�	t|dd��Wnty�Yn0|�	td	dd��|�	d
�|D],}t|�}	tj�|	�r�t�|	tj�r��qq�d}||k�r>|�r>|�dt|��|S)zO Load INI Config File order(first found is used): ENV, CWD, HOME, /etc/ansible NZANSIBLE_CONFIGF)rRzansible.cfgTr>r?z~/.ansible.cfgz/etc/ansible/ansible.cfgz�Ansible is being run in a world writable directory (%s), ignoring it as an ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir)�set�objectrA�getenvrr/�isdirr�join�appendrT�stat�st_mode�S_IWOTHrCr�OSError�access�R_OK�add)
�warningsZSENTINELZpotential_pathsZ
path_from_envZwarn_cmd_public�cwdZpermsZcwd_cfgr/�b_pathrrr �find_ini_config_file�sB


�rucCsNdd�}|��D]8\}}||�dD]"}||vr$||D]}||�q8q$qdS)zDAdd deprecation source 'ansible.builtin' to deprecations in base.ymlcSsd|vrd|dd<dS)N�
deprecatedzansible.builtinZcollection_namer)rrrr �process	sz,_add_base_defs_deprecations.<locals>.process)rV�env�varsN)�items)Z	base_defsrwZdummy�datar]rrrr �_add_base_defs_deprecationssr|c@s�eZdZgZe�Zddd�Zdd�Zd dd�Zdd	�Z	d!d
d�Z
dd
�Zdd�Zd"dd�Z
dd�Zd#dd�Zdd�Zd$dd�Zd%dd�Zdd�ZdS)&�
ConfigManagerNcCsvi|_i|_i|_||_|�|p.dtj�t��|_t	|j�|jdurTt
|j�|_|jrb|��ddd�|jd<dS)Nz%s/base.ymlr/)�default�type�CONFIG_FILE)
�
_base_defs�_plugins�_parsers�_config_file�_read_config_yaml_filerAr/�dirname�__file__r|ru�WARNINGS�_parse_config_file)�selfZ	conf_fileZ	defs_filerrr �__init__s

zConfigManager.__init__cCs^t|�}tj�|�rJt|d��}t|�p*iWd�S1s@0Ytdt|���dS)N�rbz4Missing base YAML definition file (bad install?): %s)rrAr/rC�openrr
r
)r�Zyml_fileZ
config_defrrr r�1s*
�z$ConfigManager._read_config_yaml_filecCs |dur|j}t|�}|du�r|dk�rtjdd�|j|<tt|�d��^}zt|��dd�}Wn8t	y�}z t
d|t|�f��WYd}~n
d}~00Wd�n1s�0Yz|j|�|�Wn<tj
�y}z t
d	|t|�f��WYd}~n
d}~00nt
d
t|���dS)z1 return flat configuration settings from file(s) NrV)�;)Zinline_comment_prefixesr�r>r?zNError reading config file(%s) because the config file was not utf8 encoded: %sz"Error reading config file (%s): %sz'Unsupported configuration file type: %s)r�r\�configparserZConfigParserr�r�rr�read�UnicodeErrorr	r
Zread_string�Error)r�rYrZ�fZcfg_text�errr r�;s 

H,z ConfigManager._parse_config_filecCsdS)zL Load YAML Config Files in order, check merge flags, keep origin of settingsNr)r�rrr �_find_yaml_config_filesVsz%ConfigManager._find_yaml_config_filesc		Cs8i}|�||�}|D]}|j||||||d�||<q|S)N)rr�keys�	variables�direct)�get_configuration_definitions�get_config_value)	r�r�namer�r�r��options�defs�optionrrr �get_plugin_optionsZs
z ConfigManager.get_plugin_optionscCsJg}|�||���D]0}d|vr|dr|dD]}|�|d�q0q|S�Nryr�)r��valuesrj)r�rr�Zpvars�pdef�	var_entryrrr �get_plugin_varscszConfigManager.get_plugin_varscCsVg}|�||���D]<\}}d|vr|dr|dD]}||dkr4|�|�q4q|Sr�)r�rzrj)r�rr��variabler�Zoption_namer�r�rrr �get_plugin_options_from_varlsz)ConfigManager.get_plugin_options_from_varcCs^i}|dur|j�|d�}n>|dur<|j�|i��|d�}n|j�|i��|i��|d�}|S�N)r�rar�)r�r�rr�retrrr �get_configuration_definitionvsz*ConfigManager.get_configuration_definitioncCs d}||jvr||j|v}|S)NF�r�)r�rr�Zhasrrr �has_configuration_definition�s
z*ConfigManager.has_configuration_definitionFcCsli}|dur|j}n.|dur,|j�|i�}n|j�|i��|i�}|rht|���D]}|�d�rR||=qR|S)zP just list the possible settings, either base or for specific plugins or plugin N�_)r�r�rar&r��
startswith)r�rr�Zignore_privater�Zcdefrrr r��s
z+ConfigManager.get_configuration_definitionsc
Cs�d}d}|D]�}|�d�}z|�|d�}Wn,tyV|j�d�t|���YqYn0|durt|t�rvt|dd�}|}|}d|vr|j�	|d|df�q||fS)z( repeat code for value entry assignment Nr�zCvalue for config entry {0} contains invalid characters, ignoring...r>r?rv)
ra�UnicodeEncodeErrorr�rq�formatrrEr�
DEPRECATEDrj)r��	containerZ
entry_listrNrOrr��
temp_valuerrr �
_loop_entries�s"


zConfigManager._loop_entriesc
Cstz |j|||||||d�\}}	WnNty4�Yn<tyn}
z$td|t|
�f|
d��WYd}
~
n
d}
~
00|S)z	 wrapper )rYrrr�r�r�z*Unhandled exception when retrieving %s:
%s)Zorig_excN)�get_config_value_and_originr
rbr
)r�rrYrrr�r�r�rNZ_dropr�rrr r��s�.zConfigManager.get_config_valuec
s�|dur|j}�dkr|dfSd}d}	|�||����v�r����dg�}
�r���vrf��}d}	n"�fdd�|
D�}|r�|d}d}	|dur�|rˆ��d	�r�|�|��d	�\}}	d
|	}	|dur����d�r�|r�|�|��d�\}}	d|	}	|du�rd|�rd�|v�r$|�}�}n.|
�rR|
D]"}
|
|v�r.||
}|
}�qR�q.|du�rdd|}	|du�r�d
��v�r�ddlm}|�|j��d
�\}}	d|	}	|du�r���d��r�|�tj��d�\}}	d|	}	|j	�|d�du�r|�
|�|du�r�|du�r�t|�}|�r����|��r�|dk�r�zh��dD]V}t|j	||�}|du�rN|}|}	d|v�rN|j
�d|d|df|df��qNWn>t�y�}z$tj�d|t|�f�WYd}~n
d}~00n|dk�r�|}	|du�r����dd��rF|�r,�t�|i�v�r�tdtt||�����npd}	���d�}t|t��r�|�d��r�|�d��r�|du�r�zt��|�}|�|�}Wnt�y�Yn0zt|���d�|	d �}Wn�t�y\}zp|	�d!��r"|dk�r"d}	t���d����d�|	d �}n&t d"tt||����!�|	t|�f��WYd}~n
d}~00|du�r�d#��v�r���d#du�r�d$}���d�d%k�r�t"��fd&d'�|D��}n|��d#v}|�r�t��d#t#��rd(�$d)d���d#�%�D��}n`t��d#t��r*��d#}n>t��d#t&��r\d(�$d*d���d#D��}n��d#}t d+|tt||���|f��d��v�r�|	dk�r�|j
�����d�f�ntd,tt||�����||	fS)-zY Given a config key figure out the actual value and report on the origin of the settings Nr�r�aliasesZDirectcsg|]}|�vr�|�qSrr)r)�alias)r�rr r+�r,z=ConfigManager.get_config_value_and_origin.<locals>.<listcomp>rryzvar: %s�keywordzkeyword: %sZcli)�contextzcli: %srxzenv: %srVrvz[%s]%sr]r_z%Error while loading ini config %s: %srW�requiredFz5No setting was provided for required configuration %sr~z{{z}}r)rOzenv:z6Invalid type for configuration option %s (from %s): %s�choicesTr&c3s|]}|��dvVqdS)r�Nr)r)�choice)rr�rr �	<genexpr>?r,z<ConfigManager.get_config_value_and_origin.<locals>.<genexpr>z, cSsg|]}t|��qSr�r)r)�krrr r+Gr,cSsg|]}t|��qSrr�)r)�crrr r+Kr,zFInvalid value "%s" for configuration option "%s", valid values are: %sz6Requested entry (%s) was not defined in configuration.)'r�r�rar�Zansibler�ZCLIARGSr�environr�r�r\rdr�rjrb�sys�stderr�writer
�
INTERNAL_DEFSr
r!rErr��endswithrZfrom_stringZrenderrQrMr	r'�allrrir�r)r�rrYrrr�r�r�rNrOr�Zdirect_aliasesr�r�r�rZZ	ini_entryr�r��tZinvalid_choicesZvalidr)rr�r�r r��s�








,0

�.$�*"�z)ConfigManager.get_config_value_and_origincCs&||jvri|j|<||j||<dSr�r�)r�rr�r�rrr �+initialize_plugin_configuration_definitionsZs

z9ConfigManager.initialize_plugin_configuration_definitions)NN)N)NNN)NN)NNF)NNNNNN)NNNNNN)�__name__�
__module__�__qualname__r�rer�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr r}s"



		




r})N)N)N)8Z
__future__rrrrZ
__metaclass__rIr�rAZos.pathr�rkrH�	traceback�collectionsr�collections.abcrrZjinja2.nativetypesrZansible.errorsr	r
Zansible.module_utils._textrrr
Z ansible.module_utils.common.yamlrZansible.module_utils.sixrZ)ansible.module_utils.parsing.convert_boolrZansible.parsing.quotingrZansible.parsing.yaml.objectsrZ
ansible.utilsrZansible.utils.pathrrrrrr�r!rQr9r\rdrur|rfr}rrrr �<module>s@


q
	
A