HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__pycache__/__init__.cpython-310.pyc
o

�N�g<��@spdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZddlmZddlmZddlmZddlmZe�e�Z 							dd	d
�Z!							ddd�Z"Gd
d�d�Z#Gdd�de#�Z$Gdd�de#�Z%Gdd�d�Z&Gdd�d�Z'Gdd�de'�Z(dS)z
Render the pillar data
�N)�SaltClientError)�compile_template)�merge)�OrderedDict)�__version__Fc
Cs�|d}
|�d�dkr|
dkrd}
n|
dkr|�d�rd}
ttd��|
t�}t�d�|d	rCt�d
|�t|||||||||	|d�
S||||||||||d�	S)
�J
    Return the correct pillar driver based on the file_client option
    �file_client�master_type�disable�remote�local�use_master_when_local�rrzDetermining pillar cache�pillar_cachez*get_pillar using pillar cache with ext: %s)�ext�	functions�pillar_override�	pillarenv�clean_cache�extra_minion_data�rrrr)�get�RemotePillar�Pillar�log�debug�PillarCache��opts�grains�	minion_id�saltenvr�funcsrrrrr�ptype�r$�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__init__.py�
get_pillar&s@
��r&c
Cs�|d}
|�d�dkr|
dkrd}
n|
dkr|�d�rd}
ttd��|
t�}|
dkr8|||||||||||	d�
S||||||||||d	�	S)
rrr	r
rrr
r)rrrrrr)r�AsyncRemotePillar�AsyncPillarrr$r$r%�get_async_pillards@
���r)c@s eZdZdZdd�Zdd�ZdS)�RemotePillarMixinz,
    Common remote pillar functionality
    csp�fdd�}i}d�vr0t�dt�st�d�td���dD]}tjjj|||�ddd�q t�	d|�|S)z�
        Returns the extra data from the minion's opts dict (the config file).

        This data will be passed to external pillar functions.
        cszi}}�}|�d�}|dd�D]}i||<||}|�|�s$iS||}q|d|vr1iS||d||d<|S)zz
            Returns a dict containing the opts key subtree, while maintaining
            the opts structure
            �:N���)�splitr)Zopts_keyZret_dictZaux_dictZ
config_valZsubkeysZsubkey�rr$r%�
get_subconfig�s


zIRemotePillarMixin.get_ext_pillar_extra_minion_data.<locals>.get_subconfigZpass_to_ext_pillarsz*'pass_to_ext_pillars' config is malformed.T�Zrecursive_updateZmerge_listszext_pillar_extra_data = %s)
�
isinstance�listr�	exceptionr�salt�utils�
dictupdate�updateZtrace)�selfrr/Z
extra_data�keyr$r.r%� get_ext_pillar_extra_minion_data�s
�z2RemotePillarMixin.get_ext_pillar_extra_minion_datacCs2t|t�sd�t|�j|�}t�|�t|��dS)Nz9Got a bad pillar from master, type {}, expecting dict: {})r1�dict�format�type�__name__r�errorr)r8�data�msgr$r$r%�validate_return�s

�
�z!RemotePillarMixin.validate_returnN)r>�
__module__�__qualname__�__doc__r:rBr$r$r$r%r*�s+r*c@sJeZdZdZ						ddd�Zejjjj	dd��Z
dd	�Zd
d�ZdS)
r'�(
    Get the pillar from the master
    NFcCs�||_||jd<||_||_||_tjjj�|�|_|dur#||jd<|p&i|_	t
|j	t�s6i|_	t�
d�|	p9i|_t
|jt�sIi|_t�
d�tjjj|j|�|�ddd�d|_|
|_dS�Nr!r� Pillar data must be a dictionary�&Extra minion data must be a dictionaryTr0F)rrrr r4�channel�clientZAsyncReqChannel�factoryrr1r;rr?rr5r6r7r:�_closingr�r8rrr r!rrrrrrr$r$r%�__init__�s0





�
zAsyncRemotePillar.__init__c
cs�|j|j|jd|jd|j|jddd�}|jr|j|d<|jr&|j|d<t��}z|j	j
|dd	�V}Wn=tjj
yM}z
t�|j�td
��d}~wtjjyctdtt��|��d
���tyrt�d�td
��w|�|�tjjj�|��)zT
        Return a future which will contain the pillar data from the master
        r!r�2�_pillar��idrr!rrr�ver�cmdrr�pillar�Zdictkey�Exception getting pillar.N�Pillar timed out after � seconds�Exception getting pillar:)r rrrrrr�time�	monotonicrJ�!crypted_transfer_decode_dictentryr4�crypt�AuthenticationErrorrr?�messager�
exceptions�SaltReqTimeoutError�int�	Exceptionr3rB�tornado�gen�Return�r8�load�startZ
ret_pillar�excr$r$r%�compile_pillar�sD��


���
�
z AsyncRemotePillar.compile_pillarcCs|jrdSd|_|j��dS)NT)rMrJ�close�r8r$r$r%�destroy"szAsyncRemotePillar.destroycC�|��dS�N�rpror$r$r%�__del__*�zAsyncRemotePillar.__del__�NNNNNF)
r>rCrDrErOr4rrfrg�	coroutinermrprtr$r$r$r%r'�s

�
&
%r'c@s<eZdZdZ					ddd�Zdd�Zdd�Zd	d
�ZdS)rrFNc

Cs�||_||jd<||_||_||_tjjj�|�|_|dur#||jd<|p&i|_	t
|j	t�s6i|_	t�
d�|	p9i|_t
|jt�sIi|_t�
d�tjjj|j|�|�ddd�d|_dSrG)rrrr r4rJrKZ
ReqChannelrLrr1r;rr?rr5r6r7r:rM)
r8rrr r!rrrrrr$r$r%rO5s.





�
zRemotePillar.__init__c
Cs�|j|j|jd|jd|j|jddd�}|jr|j|d<t��}z
|jj	|dd�}Wn=t
jjyC}z
t
�|j�td	��d
}~wt
jjyYtdtt��|��d���tyht
�d
�td	��w|�|�|S)z8
        Return the pillar data from the master
        r!rrPrQrRrrVrWrXNrYrZr[)r rrrrrr\r]rJr^r4r_r`rr?rarrbrcrdrer3rBrir$r$r%rmYs>�


���
�
zRemotePillar.compile_pillarcCs(t|d�r
|jr
dSd|_|j��dS)NrMT)�hasattrrMrJrnror$r$r%rp}szRemotePillar.destroycCrqrrrsror$r$r%rt�ruzRemotePillar.__del__�NNNNN)r>rCrDrErOrmrprtr$r$r$r%r0s

�$$rc@sFeZdZdZ						ddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)ra/
    Return a cached pillar if it exists, otherwise cache it.

    Pillar caches are structed in two diminensions: minion_id with a dict of
    saltenvs. Each saltenv contains a pillar dict

    Example data structure:

    ```
    {'minion_1':
        {'base': {'pilar_key_1' 'pillar_val_1'}
    }
    NFcCsz||_||_||_||_||_||_||_|
|_|	|_|dur#d|_	n||_	t
jjj
j|jd|jd|�|�d�|_dS)N�base�pillar_cache_backendZpillar_cache_ttl)Zminion_cache_path)rrr rrrrrrr!r4r5�cacheZCacheFactoryrL�_minion_cache_pathrNr$r$r%rO�s"
�zPillarCache.__init__cCstj�|jdd|�S)zn
        Return the path to the cache file for the minion.

        Used only for disk-based backends
        Zcachedirr)�os�path�joinr)r8r r$r$r%r}�szPillarCache._minion_cache_pathcCs@t�d|j�t|j|j|j|j|j|jd|j	|j
d�	}|��S)zn
        In the event of a cache miss, we need to incur the overhead of caching
        a new pillar.
        z1Pillar cache getting external pillar with ext: %sN)rrrrr)rrrrrrr r!rrrrm)r8�fresh_pillarr$r$r%�fetch_pillar�s�zPillarCache.fetch_pillarcCs|j��dS)z!
        Clear the cache
        T)r|�clearror$r$r%�clear_pillar�s
zPillarCache.clear_pillarcOs|jr|��t�d|j|j�|jddkr|j}n|jj}t�d|�|j|jvrf|j|j|jvrFt�d|j|j�|j|j|jS|�	�}|j|j}|||j<||j|j<t�d|j|j�|S|�	�}|j|i|j|j<t�d|j�t�d|�|S)	NzFScanning pillar cache for information about minion %s and pillarenv %sr{ZmemoryzScanning cache: %sz/Pillar cache hit for minion %s and pillarenv %sz0Pillar cache miss for pillarenv %s for minion %szPillar cache miss for minion %szCurrent pillar cache: %s)
rr�rrr rrr|�_dictr�)r8�args�kwargsZ
cache_dictr�Zminion_cacher$r$r%rm�sD��
�zPillarCache.compile_pillarrv)	r>rCrDrErOr}r�r�rmr$r$r$r%r�s
�'rc@s�eZdZdZ					d)dd�Zdd�Zdd�Zd*d	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zd+dd�Z
d,dd�Zd,dd�Zdd�Zd,dd�Zd-d!d"�Zd#d$�Zd%d&�Zd'd(�ZdS).rzC
    Read over the pillar top files and render the pillar data
    Nc
Cs�||_||_|dur|�dd�r||d<|j||||d�|_||_tj�|jd�|_	tj�|jd�|_|�
�|_|�dd�dkrJ|�d	d�sJ||d
<|dur�tjj
||j	d�}
|�dd�dkrotjj||
tj�|j�d�|_ntjj|j|
tj�|j�d�|_n||_||jd
<tj�|j�|_tjj|j|j|j	|j	d�|_t�|j�}d|vr�|d|d<d|_|�d�r�|d|_tj�||j�|_i|_|p�i|_t|jt�s�i|_t�d�|	p�i|_t|jt�s�i|_t�d�d|_ dS)NZpillarenv_from_saltenvFr)r!rTr�rr
r)r)r5rr rSZsmart�pillar_source_merging_strategyrHrI)!r rr�_Pillar__gen_optsrr!r4�
fileclientZget_file_clientrK�_Pillar__gather_avail�avail�loaderr5Zminion_modsZContextlessFileClientr�matchers�render�rend�copy�deepcopy�merge_strategyZpillars�ext_pillars�ignored_pillarsrr1r;rr?rrM)r8rrr r!rrrrrr5Zext_pillar_optsr$r$r%rOsd
�
�
�
�






zPillar.__init__cs�t|jt�st�d|j�dS|�dg��z�fdd�|jD�}Wnty0t�d�YdSw|rDt�dd�t|��d����dSd	S)
zJ
        Check to see if the on demand external pillar is allowed
        z4On-demand pillar %s is not formatted as a dictionaryFZon_demand_ext_pillarcsh|]}|�vr|�qSr$r$��.0�x�Z	on_demandr$r%�	<setcomp>l�z6Pillar.__valid_on_demand_ext_pillar.<locals>.<setcomp>zlThe 'on_demand_ext_pillar' configuration option is malformed, it should be a list of ext_pillar module namesz�The following ext_pillar modules are not allowed for on-demand pillar data: %s. Valid on-demand ext_pillar modules are: %s. The valid modules can be adjusted by setting the 'on_demand_ext_pillar' config option.�, T)	r1rr;rr?r�	TypeErrorr��sorted)r8rZinvalid_on_demandr$r�r%Z__valid_on_demand_ext_pillarbs(���z#Pillar.__valid_on_demand_ext_pillarcCs&i}|��D]
}|j�|�||<q|S)zH
        Gather the lists of available sls data from the master
        )�	_get_envsrKZlist_states)r8r�r!r$r$r%Z__gather_avail�szPillar.__gather_availc
Cs�t�|�}d|d<|si|d<n||d<|dur|n|�d�|d<|dur'|n|�d�|d<|j|d<|d�d	�rA|d|d<n"|d�d
�rXtjj�|ddd��|d<ntjj�|d�|d<|j	r~|�
|�r~d|vrx|d�|j	�n|j	g|d<d
|dvr�|�d�p�|�d�p�d}||dvr�t�
d|�|d�d
�|d|<t|d|�D]\}}	|d||�d
|�|d||<q�|St�
d|�|d�d
�|S)zN
        The options need to be altered to conform to the file client
        rrrNr!rrS�	state_topzsalt://�/��
ext_pillarZ__env__�pillar_rootsrzz>pillar environment '%s' maps to __env__ pillar_roots directoryzEpillar_roots __env__ ignored (environment '%s' found in pillar_roots))r�r�rr �
startswithr4r5�url�creater�#_Pillar__valid_on_demand_ext_pillar�appendrr�pop�	enumerate�replace)
r8Zopts_inrr!rrr�env�idx�rootr$r$r%Z
__gen_opts�sN

�
 �
��	��zPillar.__gen_optscs6dg�d|jvr���fdd�t|jd�D���S)zM
        Pull the file server environments out of the master options
        rzr�csg|]}|�vr|�qSr$r$r��Zenvsr$r%�
<listcomp>�r�z$Pillar._get_envs.<locals>.<listcomp>)r�extendr2ror$r�r%r��s
"zPillar._get_envsc
Cs�t�t�}t�t�}t�t�}g}zqt�}|jdr>|jd|jdvr5t�d|jdd�|jd��n!|�|jd�n|�	|�
��|j�dd�dkrV||jpSdhM}|D](}|j
�|jd	|�}|r�||�t||j|jd
|jd|jd|d
d��qXWn!ty�}z|�d|���t�d|j�WYd}~nd}~ww|��D]!\}}	|	D]}
d|
vr�q�|
dD]	}||�|�q�|
�d�q�q�|�rGg}|��D]a\}}
|�|�|
s�q�|
D]R}|||vr�q�z%||�t|j
�||��dd�|j|jd
|jd|jd|d
d��Wnt�y+}z|�d�||��WYd}~nd}~ww||�|�q�q�|D]
}||v�rC|�|��q7|s�||fS)z&
        Gather the top files
        rr�zCpillarenv '%s' not found in the configured pillar environments (%s)r�r�NZnonerzr��renderer�renderer_blacklist�renderer_whitelistT)r!�_pillar_rendz1Rendering Primary Top file failed, render error:
z%Pillar rendering failed for minion %s�include�destFz.Rendering Top file {} failed, render error:
{})�collections�defaultdictr2�setrrrr��addr7r�rr!rKZ
cache_filer�rr�rer3r �itemsr��	get_stater<)r8�topsr�Zdone�errorsZsaltenvsr!�toprl�ctops�ctop�slsZpops�statesr$r$r%�get_tops�s�



��������
�������

�� zPillar.get_topsc
Cs\t�t�}t�t�}|��D]�}|D]�}|��D]�\}}|dkr!q|D]�}g}	t�}
d|||<d}|||D]F}t|t�rud|vrH|	�|�d|vrm|d}
t|
t�sgzt|
�}
Wnt	yfd}
Ynw|
|||<|�
dd�rud}t|t�r~d|
|<q8|r�||jvr�g|j|<|j|�
|
���|	|||<|||�
|
�q#qqq|�||�S)z-
        Cleanly merge the top files
        r�rF�match�order�ignore_missingT)r�r�r�valuesr�r1r;r�rd�
ValueErrorr�strr�r��keys�sort_top_targets)r8r�r��ordersr�r�r!�targetsZtgt�matchesr�r��compr�r$r$r%�
merge_topssP




�
�

���zPillar.merge_topscsPt�t�}|��D]\�}t|��fdd�d�}|D]
}|||�|<qq	|S)zH
        Returns the sorted high data from the merged top files
        cs��|Srrr$)�target�r�r!r$r%�<lambda>Jsz)Pillar.sort_top_targets.<locals>.<lambda>)r9)r�r�rr�r�)r8r�r�Z
sorted_topr�Zsorted_targetsr�r$r�r%r�Cs
�zPillar.sort_top_targetsc
Cs\|��\}}z
|�|�}W||fSty-}zt�}|�d�WYd}~||fSd}~ww)zA
        Returns the high data derived from the top file
        z2Error encountered while rendering pillar top file.N)r�r�r�rr�)r8r�r�Zmerged_tops�errr$r$r%�get_topPs���zPillar.get_topFc
	Cs�i}|rtj�|j�|_|��D]J\}}|jdr!||jdkr!q|��D]4\}}|jd|||j�di��rY||vrBg||<}n||}|D]}	t|	t�rX|	|vrX|�|	�qHq%q|S)z�
        Search through the top high data for matches and return the states
        that this minion needs to execute.

        Returns:
        {'saltenv': ['state1', 'state2', ...]}

        reload
            Reload the matcher loader
        rzconfirm_top.confirm_topZ
nodegroups)	r4r�r�rr�rr1r�r�)
r8r��reloadr�r!�bodyr�r@Zenv_matches�itemr$r$r%�top_matches\s,
�
��
zPillar.top_matchescCsF|duri}d}g}|j�||�}|�dd�}|sm||j�|g�vr.t�d||�d||fS|jd�|�rGd�||�}	t�|	�|�	|	�n&d�||�}	|j�d	d�d
ur[|	d7}	n|	d�||�7}	t�|	�d||fSd}
zt
||j|jd
|jd|jd||fdd
i|��}
Wn6ty�}z*d|�d|��}	tj
|	d
d�|j�dd
�r�|�	d�|��n|�	|	�WYd}~nd}~ww|
||<d}|
�rt|
t�s�d|�d�}	t�|	�|�	|	��n<d|
v�rt|
dt�s�d�|�}	t�|	�|�	|	��ng}
|
�d�D]�}t|t��r%tt|����\}}|�di�}|�dd�}nd}zKt�|j||�d��dd��}|�d��rc|�dd��d��rN|�d�}n	|�d�dd �}d�||d!d�g�}t�|j||�}|�|�Wnt�y�|�d"�|�g�|g}Ynwt |�d!k�r�|g}|D]U}||v�r�|�!||||�\}}}n||}|�r�|�r�t"|�d#��D]}||i}�q�|j�d$d��s�|
�	|�nt#|
||j$|j�d
d%�|j�d&d��}
|�r�||7}�q��q|j�d$d��s|
�	|
�d}
|
D]}|
du�r	|}
�q�t#|
||j$|j�d
d%�|j�d&d��}
�q�|
||fS)'z@
        Collect a single pillar sls file and render it
        Nr�r�Fz9Skipping ignored and missing SLS '%s' in environment '%s'r�zJSpecified SLS '{}' in environment '{}' is not available on the salt masterz6Specified SLS '{}' in environment '{}' was not found. Z__git_pillarTz�This is likely caused by a git_pillar top file containing an environment other than the one for the branch in which it resides. Each git_pillar branch/tag must have its own top file.z�This could be because SLS '{0}' is in an environment other than '{1}', but '{1}' is included in that environment's Pillar top file. It could also be due to environment '{1}' not being defined in 'pillar_roots'.r�r�r�r�zRendering SLS 'z' failed, render error:
��exc_infoZpillar_safe_render_errorz=Rendering SLS '{}' failed. Please see master log for details.zSLS 'z!' does not render to a dictionaryr�z7Include Declaration in SLS '{}' is not formed as a list�defaultsr9�.r��sourcez	/init.slsr,r��9No matching pillar environment for environment '{}' foundr+Zpillar_includes_override_sls�yaml�pillar_merge_lists)%rKr�rr�rrrr<r?r�rr�re�criticalr1r;r2r��next�iterr��fnmatch�filterr��lstripr�r��endswithr-r�r��KeyError�len�
render_pstate�reversedrr�)r8r�r!�modsr�r�r�Z
state_dataZfn_rA�staterlZnstateZinclude_statesZsub_sls�vr9�matched_pstatesZ
include_partsr�Z	m_sub_slsZkey_fragment�sr$r$r%r�}s$�
�
���

��	
��
��



�
�����
�	
�����

�
zPillar.render_pstatec
Cs t�|j�}|durg}|��D]{\}}g}i}|D]/}g}	zt�|j||�}	Wnty;|�d�|�g�Ynw|	rD|�|	�q|�	|�q|D]>}
|�
|
||�\}}}|r^||7}|dur�t|t�swt
�d|
d�dd�|D���qLt|||j|j�dd�|j�d	d
��}qLq||fS)zg
        Extract the sls pillar files from the matches and render them into the
        pillar
        Nr�z�The rendered pillar sls file, '%s' state did not return the expected data format. This is a sign of a malformed pillar sls file. Returned errors: %sr�cSsg|]}d|�d��qS)�'r$)r��er$r$r%r�Pr�z(Pillar.render_pillar.<locals>.<listcomp>r�r�r�F)r�rr�r�r�r�r�r�r<r�r�r1r;rr?r�rr�rr)
r8r�r�rVr!ZpstatesZpstatefilesr�Z	sls_matchr�r�Zpstater�r$r$r%�
render_pillar'sT���
����zPillar.render_pillarcCsd}tjj�|j|�j}t|t�r:d|vr+|jr+|j||j|fd|ji|��}|S|j||j|fi|��}|St|t	�rhd|vrY|jrY|j||j|g|�Rd|ji�}|S|j||j|g|�R�}|Sd|vr~|jr~|j||j|||jd�}|S|j||j||�}|S)zY
        Builds actual pillar data structure and updates the ``pillar`` variable
        Nr)r)
r4r5r�Zget_function_argspecr�r1r;rr r2)r8rV�valr9rr�r$r$r%�_external_pillar_data]sL
����
��������zPillar._external_pillar_datac
Cs,|durg}z7|jr<d|jvr<|j�d�dkr<ddl}ddl}|jjj|j|jd|jj	j
|jj	j|jj	jd�}|�
�Wn	tyFYnwd|jvrP||fSt|jdt�sh|�d�t�|d	�||fSd}|jr�t||j|j|j�d
d�|j�dd
��}|jdD]�}t|t�s�|�d�t�|d	�i|fStt|����|j�dg�vr�q�|��D]E\}}||jvr�t�d|�q�z	|�|||�}Wq�ty�}	z |�d�||	��t� d|d�!t"�#t$�%�d���WYd}	~	q�d}	~	ww|�rt|||j|j�d
d�|j�dd
��}d}q�||fS)z1
        Render the external pillar data
        N�gitZ__roleZminionr)Zper_remote_overridesZper_remote_onlyZglobal_onlyr�z$The "ext_pillar" option is malformedr,r�r�r�FZexclude_ext_pillarz0Specified ext_pillar interface %s is unavailablez Failed to load ext_pillar {}: {}z,Exception caught loading ext_pillar '%s':
%sr��)&rrrZsalt.pillar.git_pillarZsalt.utils.gitfsr5ZgitfsZ	GitPillarrV�
git_pillarZPER_REMOTE_OVERRIDESZPER_REMOTE_ONLYZGLOBAL_ONLYZ
fetch_remotesr�r1r2r�rr�rrr�r;r�r�r�r�r�r�rer<r?r��	traceback�	format_tb�sysr�)
r8rVr�r4r�r�runr9r�rlr$r$r%r��s� ���

�


��������zPillar.ext_pillarTc
	Cs�|��\}}|ra|j�dd�rK|�|j�\|jd<}tj�|j|j�|_	|j
|dd�}|j||d�\}}t|jd||j
|j�dd�|j�d	d��}n"|�
|�}|�|�\}}|j||d�\}}n|�
|�}|�|�\}}|�|�|j�d
d�r�t|j�}d|vr�|�d�t|d<||d
<d|jvr�|j�dd�r�t|jd||j
|j�dd�|j�d	d��}|r�|D]}t�d|�q�||d<|jr�t||j|j
|j�dd�|j�d	d��}|�|�}	|	r�|�dg��|	�|S)z3
        Render the pillar data and return
        Zext_pillar_firstFrVT)r�)r�r�r�r�Zpillar_optsrZsaltversionZmasterZssh_merge_pillarzPillar render error: %s�_errors)r�rrr�rr4r�r�rr�r�r�rr�r�r;r�rrr��decrypt_pillar�
setdefault)
r8rr�Z
top_errorsr�r�rVZmoptsr?Zdecrypt_errorsr$r$r%rm�sd�




��
zPillar.compile_pillarcCs�g}|j�d�r�|jd}t|t�stjj�|jd�}|s#|�d�|�	�D]�\}}tjjj
||d|jdd�}|durDt�d|�q'zt
|�d}WntyWd}Ynwz@tjjj||pd|jd	|j|j|jd
d�}|r�|�|jd�\}	}
}|	s�|}ntjjj
||	d|jdd�}|dur�|||<Wq'ty�}zd|�d
|��}
|�|
�tj|
dd�WYd}~q'd}~ww|S)zW
        Decrypt the specified pillar dictionary items, if configured to do so
        rz)decrypt_pillar config option is malformedNZdecrypt_pillar_delimiter)�default�	delimiterzPillar key %s not presentTFZdecrypt_pillar_defaultZdecrypt_pillar_renderers)Z	renderersrZ
valid_rendzFailed to decrypt pillar key 'z': r�)rrr1r;r4r5r@Zrepack_dictlistr�r�Z
traverse_dictrr�hashr�r_Zdecryptr��
rpartitionrer?)r8rVr�rr9r��ptrZ	immutable�ret�parent�_�childrlrAr$r$r%rsn

�
���
���
��zPillar.decrypt_pillarcCsh|jrdSd|_|jrz|j��Wn	tyYnw|jr2z|j��WdSty1YdSwdS)zS
        This method exist in order to be API compatible with RemotePillar
        NT)rMrKrp�AttributeErrorr�ror$r$r%rpOs ���zPillar.destroycCrqrrrsror$r$r%rtbruzPillar.__del__ry)NNN)Frr�T)r>rCrDrErOr�r�r�r�r�r�r�r�r�r�r�r�r�rmrrprtr$r$r$r%rs4

�H
	/	Y(

!
+6
'
Q;?rcs*eZdZejjjjd�fdd�	�Z�Z	S)r(Tcst�j|d�}tjjj�|��)N)r)�superrmr4rrfrgrh)r8rr
��	__class__r$r%rmkszAsyncPillar.compile_pillarr)
r>rCrDr4rrfrgrwrm�
__classcell__r$r$rr%r(js
r()NNNNNNF))rEr�r�r��loggingr~rr\r�Zsalt.channel.clientr4Zsalt.ext.tornado.genZsalt.fileclientZsalt.loaderZsalt.minionZsalt.utils.argsZsalt.utils.cacheZsalt.utils.cryptZsalt.utils.dataZsalt.utils.dictupdateZsalt.utils.urlZsalt.exceptionsrZ
salt.templaterrZsalt.utils.odictrZsalt.versionr�	getLoggerr>rr&r)r*r'rrrr(r$r$r$r%�<module>sn

�B
�3:_[[