%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/state.pyo

�
���^c#@@sTdZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddljjZddl Zddl!Zddl"Zddl#j$Z$ddl%Zddl&m'Z(m)Z*ddl+m,Z,m-Z-ddl.m/Z/m0Z0ddl1m2Z2m3Z3ddl4jj5Z5ddl6Z6ddl7m8Z8dd	l9m:Z:m;Z;m<Z<e
j=e>�Z?e@d
ddd
ddddddddg�ZAe@ddddddg�ZBe@ddddd d!d"d#d$dddd%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g"�ZCeAjDeB�jDeC�ZEd;�ZFeFe2_Gd<�ZHd=�ZId>�ZJd?�ZKd@�ZLdA�ZMdB�ZNdC�ZOdD�ZPdE�ZQdF�ZRdG�ZSdH�ZTdI�ZUdJeVfdK��YZWdLeXfdM��YZYdNeXfdO��YZZdPeXfdQ��YZ[dRe[fdS��YZ\dTeZfdU��YZ]dVe\fdW��YZ^dXeXfdY��YZ_dS(Zu�
The State Compiler is used to execute states in Salt. A state is unlike
an execution module in that instead of just executing a command, it
ensures that a certain state is present on the system.

The data sent to the state calls is as follows:
    { 'state': '<state module name>',
      'fun': '<state function name>',
      'name': '<the name argument passed to all states>'
      'argn': '<arbitrary argument, can have many of these>'
      }
i(tabsolute_importtprint_functiontunicode_literalsN(t	serializetdeserialize(tcompile_templatetcompile_template_str(tSaltRenderErrortSaltReqTimeoutError(tOrderedDicttDefaultOrderedDict(tsix(tmaptranget
reload_moduleu	onchangesu
onchanges_anyuonfailu
onfail_anyuonfail_stopuprerequprerequireduwatchu	watch_anyurequireurequire_anyulistenuonchanges_inu	onfail_inu	prereq_inuwatch_inu
require_inu	listen_inufunustateu	check_cmdufailharduonlyifuunlessuretryuorderuparallelureload_modulesu
reload_grainsu
reload_pillarurunasurunas_passwordu
fire_eventusaltenvuuseuuse_inu__env__u__sls__u__id__u__orchestration_jid__u
__pub_useru	__pub_argu	__pub_jidu	__pub_funu	__pub_tgtu	__pub_retu	__pub_pidu__pub_tgt_typeu
__prereq__cC@s
t|�S(N(tid(tself((s./usr/lib/python2.7/site-packages/salt/state.pyt_odict_hashable�scC@s;|jd�\}}}}i|d6|d6|d6|d6S(uN
    Take a low tag and split it back into the low dict that it came from
    u_|-ustateu__id__unameufun(tsplit(ttagtstatetid_tnametfun((s./usr/lib/python2.7/site-packages/salt/state.pyt
split_low_tag�s

cC@s
dj|�S(uJ
    Generate the running dict tag string from the low data structure
    u/{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}(tformat(tlow((s./usr/lib/python2.7/site-packages/salt/state.pyt_gen_tag�scC@stjjj|�S(u*
    Make tag name safe for filenames
    (tsalttutilstfilestsafe_filename_leaf(R((s./usr/lib/python2.7/site-packages/salt/state.pyt
_clean_tag�scC@s>idj|�d6dj|�d6dd6dd6}t|�S(Nu
listen_{0}unameu__id__uListen_Errorustateufun(RR(RRR((s./usr/lib/python2.7/site-packages/salt/state.pyt_l_tag�s

cC@s|tjj�}|tjj�tjj�}tjj�}|j�j�}||}|jd|jd}||fS(uk
    Generate a NULL duration for when states do not run
    but we want the results to be consistent.
    i@Bg@�@(tdatetimetutcnowtnowttimet	isoformattsecondstmicroseconds(tutc_start_timetlocal_start_timetutc_finish_timet
start_timetdeltatduration((s./usr/lib/python2.7/site-packages/salt/state.pyt_calculate_fake_duration�s
cC@s;tjj|d�}tjj|�s7tj|�n|S(ug
    Return the directory that accumulator data is stored in, creating it if it
    doesn't exist.
    uaccumulator(tostpathtjointisdirtmakedirs(tcachedirtfn_((s./usr/lib/python2.7/site-packages/salt/state.pytget_accumulator_dir�scC@s>tt|��}d|kr:i|||jd�d6S|S(u.
    Trim any function off of a requisite
    u.i(tnexttiterR(treqtreqfirst((s./usr/lib/python2.7/site-packages/salt/state.pyttrim_req�scC@s�t�}||kr|S|||kr-|Sx\|||D]L}t|t�sWq<nt|�dkroq<n|jtt|���q<W|S(uA
    Return a set of the arguments passed to the named state
    i(tsett
isinstancetdicttlentaddR8R9(RRthightargstitem((s./usr/lib/python2.7/site-packages/salt/state.pyt
state_args�s	cC@sCg}||kr(|j||f�n|dkr�xtj|�D]>\}}|d|krD|j|tt|��f�qDqDWn�x�|D]�}|||kr�t|||t�r;xx|||D]e}t|t�s�q�nt|�dkr�q�n|tt|��|kr�|j||f�q�q�Wq;q�q�W|S(u�
    Scan high data for the id referencing the given name and return a list of (IDs, state) tuples that match

    Note: if `state` is sls, then we are looking for all IDs that match the given SLS
    uslsu__sls__i(	tappendRt	iteritemsR8R9R>tlistR?R@(RRRBtext_idtnidRDtarg((s./usr/lib/python2.7/site-packages/salt/state.pyt	find_name�s$)
$cC@s�g}x�tj|�D]�\}}y|d}Wn6tk
rh|dkrtjd||�qqqX||krx9|D].}|jd�r�q|n|j||f�q|WqqW|S(uT
    Scan for all ids in the given sls and return them in a dict; {name: state}
    u__sls__u__exclude__u2Invalid non-dict item '%s' in high data. Value: %ru__(RRGt	TypeErrortlogterrort
startswithRF(tslsRBtretRJRDtsls_tgttst_((s./usr/lib/python2.7/site-packages/salt/state.pytfind_sls_idss 


cC@s!d}t|t�rd|kr|d}|sZ|drH|d}q�dj|�}nNt|t�r�d|kr�t|dtj�r�dj|d�}q�ntgtj|�D]}t|t�^q��r�tgtj|�D]}d|kod|k^q��r�d	}x�|D]}||d}|rR|td
fkrRd
}n||d}|r�|td
fkr�d
}n|dj|||�7}qWq�q�n|s�tj	|d�}n|dt
ks�|dd
kr�tj|�qtj
|�qntjtj	|��d
S(u-
    Format the state into a log message
    uuchangesucommentuNo changes made for {0[name]}udiffuFile changed:
{0}uoldunewuMade the following changes:
uabsentu"'{0}' changed from '{1}' to '{2}'
uresultN(R>R?RRtstring_typestallt
itervaluestFalsetNonet	text_typetTrueRNtinfoRO(RRtmsgtchgtxtpkgtoldtnew((s./usr/lib/python2.7/site-packages/salt/state.pyt
format_logs<


14
		& cC@s"t|||||�}|j�S(uQ
    Compile the master side low state data, and build the hidden state file
    (tMasterHighStatetcompile_highstate(tmaster_optstminion_optstgrainsRtsaltenvRT((s./usr/lib/python2.7/site-packages/salt/state.pytmaster_compileHscC@s'yt|�Wntk
r"tSXtS(N(thashRMRYR\(tobj((s./usr/lib/python2.7/site-packages/salt/state.pyt
ishashablePs

cC@sI|dr|dd}n|dd}i|d6dd6id6td6S(	uo
    Returns a mocked return dict with information about the run, without
    executing the state function
    uargsiukwargsunameuNot called, mockeducommentuchangesuresult(R\(tcdataR((s./usr/lib/python2.7/site-packages/salt/state.pytmock_retXs

t
StateErrorcB@seZdZRS(u!
    Custom exception class.
    (t__name__t
__module__t__doc__(((s./usr/lib/python2.7/site-packages/salt/state.pyRqistCompilercB@sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(uB
    Class used to compile and manage the High Data structure
    cC@s||_||_dS(N(toptstrend(RRvt	renderers((s./usr/lib/python2.7/site-packages/salt/state.pyt__init__ts	cK@sJt||j|jd|jd|jd|�}|s=|S|j|�S(u2
        Enforce the states in a template
        urendererurenderer_blacklisturenderer_whitelist(RRwRvt	pad_funcs(RttemplatetkwargsRB((s./usr/lib/python2.7/site-packages/salt/state.pytrender_templatexs


	cC@s�x�|D]�}t||t�s�t||tj�r�d||kr||jd�}t|�dkr�dj|dt|�!�|d<ni|dg|d6||<qqqq�nt�}xt||�D]�}|j	d�r�q�nt|||t
�sq�nd|kr�|jd�}t|�dkr[dj|dt|�!�|d<n|d|krqq�n||j|�|||d<|||dj|d�|j
|d�q�n|j
|�q�WqW|S(uI
        Turns dot delimited function refs into function strings
        u.iiiu_(R>R?RRVRR@R2R=tsortedRPRHtpopRFRA(RRBRtcompstskeystkey((s./usr/lib/python2.7/site-packages/salt/state.pyRz�s:
#		#
cC@sjg}t|t�s%|jd�nt�}x5tj|�D]$\}}|jd�r_q>nt|tj�s�|jdj||dt	|�j
��nt|t�s�dj||�}|j|�q>nx�|D]�}|jd�r�q�nt||t�s&|jdj||d��q�d}d|krE|d	7}nx�||D]�}	t|	tj�r�|d	7}d
|	j�kr�|jdj|	||d��q�qPt|	t�rPt
t|	��}
|
dkr�t|	|
t�s
|jdj|
||d��n�i|d6||<x�|	|
D]}t|tj�rQi|d6}nt|t�s�dj||d�}|j|�q)nt
t|��}||}
d|kr�|jdj|||d||jd� ��nt|
�s|jdjtj|
�|d��q)n||||
<|
|kr)|||
kr�||
||kr�||
d|||
kr�dj|d||
�}|j|�q�q�q�q)q)Wtt|	��d	kr�|jdj||d��q�q�qPqPW|s2|dks�|d
krq�n|jdj||d��q�|d	kr�|jdj||d��q�q�Wq>W|S(uT
        Verify that the high data is viable and follows the data structure
        u,High data is not a dictionary and is invalidu__u=ID '{0}' in SLS '{1}' is not formed as a string, but is a {2}u__sls__u4The type {0} in {1} is not formatted as a dictionaryu0State '{0}' in SLS '{1}' is not formed as a listiu.iu u�The function "{0}" in state "{1}" in SLS "{2}" has whitespace, a function with whitespace is not supported, perhaps this is an argument that is missing a ":"urequireuwatchuprerequ	onchangesuJThe {0} statement in state '{1}' in SLS '{2}' needs to be formed as a listustateuiduMRequisite declaration {0} in SLS {1} is not formed as a single key dictionaryuuInvalid requisite type '{0}' in state '{1}', in SLS '{2}'. Requisite types must not contain dots, did you mean '{3}'?u$Illegal requisite "{0}", is SLS {1}
u<A recursive requisite was found, SLS "{0}" ID "{1}" ID "{2}"uEMultiple dictionaries defined in argument of state '{0}' in SLS '{1}'u0No function declared in state '{0}' in SLS '{1}'u7Too many functions declared in state '{0}' in SLS '{1}'(urequireuwatchuprerequ	onchanges(R>R?RFR	RRGRPRVRttypeRrRHtstripR8R9tfindRnR[R@(RRBterrorstreqsRtbodyterrRRRKtargfirstR:treq_keytreq_val((s./usr/lib/python2.7/site-packages/salt/state.pytverify_high�s�	






	cC@s�d}xi|D]a}d|kr
t|dt�s8q
n|d}||dkrn|dkrn|d}qnq
q
Wx|D]�}d|kr�||d<qynt|dttf�s�|ddkr�|d|d<q�|ddkr�d|d<q�||d<nd|kr-|d|jd�d	|d<n|ddkrV|d|d|d<ntjjj|d
�|d
<qyW|jdd��|S(
ux
        Sort the chunk list verifying that the chunks follow the order
        specified in the order options.
        iuorderiidulasti@Bufirstu
name_orderg��@unameR�cS@s|ddj|�fS(Nuorderu{0[state]}{0[name]}{0[fun]}(R(tchunk((s./usr/lib/python2.7/site-packages/salt/state.pyt<lambda>ds(	R>tinttfloatRRRtdatatdecodetsort(RtchunkstcapR�tchunk_order((s./usr/lib/python2.7/site-packages/salt/state.pytorder_chunksEs2





"!cC@s�g}xytj|�D]h\}}|jd�r7qnxDtj|�D]3\}}t�}g}|jd�rwqGni|d6|d6}	d|kr�|d|	d<nd|kr�|d|	d<n||	d<x�|D]�}
t|
tj�r|j|
�q�nt|
t�r�xltj|
�D]X\}}|dkrkx*|D]"}
|
|kr?|j|
�q?q?Wq q |	j	|
�q Wq�q�W|rCd}x�|D]�}t
j|	�}t|t�r�ttj
|��}||d<tt|j	||��n
||d<||d	<|d}x%|D]}||d
<|j|�qWq�WqGt
j|	�}x%|D]}||d
<|j|�qYWqGWqW|j|�}|S(u�
        "Compile" the high data as it is retrieved from the CLI or YAML into
        the individual state executor structures
        u__ustateunameu__sls__u__env__u__id__unamesiu
name_orderufun(RRGRPR=R>RVRAR?RFtupdatetcopytdeepcopyR8titerkeysRHRR�(RRBR�RR�RtruntfuncstnamesR�RKR�tvalt_namet
name_ordertentrytlivetlow_nameR((s./usr/lib/python2.7/site-packages/salt/state.pytcompile_high_datags`	














c
C@szd|kr|St�}t�}|jd�}x�|D]�}t|tj�r`|j|�nt|t�r8t|�dkr�q8nttj	|��}|dkr�|j|d�q�|dkr�|j|d�q�q8q8W|rIx]tj
|�D]I\}}|jd�rq�n|jdd�|kr�|j|�q�q�Wnx*|D]"}	|	|krP|j|	�qPqPW|S(ui
        Read in the __exclude__ list and remove all excluded objects from the
        high data
        u__exclude__iuslsuidu__u__sls__u(
R=RR>RRVRAR?R@R8R�RGRPtget(
RRBtex_slstex_idtexcludetexcR�RR�R((s./usr/lib/python2.7/site-packages/salt/state.pyt
apply_exclude�s4		

(
RrRsRtRyR}RzR�R�R�R�(((s./usr/lib/python2.7/site-packages/salt/state.pyRups			1	�	"	9tStatec	B@s�eZdZd,d,d,d,d,edd,d�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd,d,d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd,d�Zd�Zd�Zd�Zd�Zd�Zejjjj dd�d,d,dd��Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(ed$�Z)ed%�Z*d&�Z+d'�Z,d,d(�Z-d)�Z.d*�Z/d+�Z0RS(-u+
    Class used to execute salt states
    ustatesc

	C@s�||_d|kr.tjj|�|d<n||_||_||_|dk	r�y|j�}Wq�t	k
r�t
j|�j�}q�Xn||_t
jd�|	r�|jr�|	|jd<n~|j�|jd<|jrEtjjj|jd|j|jjdd�|jjdd�|jjdt��|jd<nt
jd	�|p[i|_|j�t�|_t�|_i|_d
|_||_t
jt|��|_i|_||_ dS(Nugrainsu#Gathering pillar data for state runupillarupillar_source_merging_strategyusmarturendereruyamlupillar_merge_listsu,Finished gathering pillar data for state runi(!t
states_loaderRtloaderRiRvtproxyt_pillar_overrideRZtlowertAttributeErrorRR[t_pillar_encRNtdebugt_gather_pillarRt
dictupdatetmergeR�RYt	state_contload_modulesR=tactivetmod_inittpret_State__run_numtjidRtinstance_idtinject_globalstmocked(
RRvtpillar_overrideR�t
pillar_encR�tcontextR�R�tinitial_pillar((s./usr/lib/python2.7/site-packages/salt/state.pyRy�sD				
	
	
"

				cC@s~|jr&|jr�yStjjj|j|jdtdt|dd�d|j	d|j	d�|_Wq�t
k
r�}tjd|�q�Xnt
|jtj�r�y"tj|jdtj�|_Wq�t
k
r�}tjd	�tj|�q�Xnt
|jt�s&tjd
�d|_q&ntjj|j	|j	d|j	d|j	d
d|jd|j	jd��}|j�S(uK
        Whenever a state run starts, gather the pillar data fresh
        ttranslate_newlinesRxurendRvt
valid_rendudecrypt_pillar_renderersu%Failed to decrypt pillar override: %stLoaderu"Failed to load CLI pillar overrideu.Pillar override was not passed as a dictionaryugrainsuidusaltenvR�t	pillarenvu	pillarenvN(R�R�RRtcrypttdecryptR\tgetattrRZRvt	ExceptionRNROR>RRVt
yamlloadertloadtSaltYamlSafeLoadert	exceptionR?tpillart
get_pillarR�tcompile_pillar(RR�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR��s>					

	


	cC@s�y#|jdj|d|d�Wntk
r7dSXdj|d�}|d|jkr�||jjkr�|j||�}|s�dS|jj|d�q�ndS(u�
        Check the module initialization function, if this is the first run
        of a state package that has a mod_init function, then execute the
        mod_init function in the state module.
        u{0}.{1}ustateufunNu{0}.mod_init(tstatesRtKeyErrorR�t_dictRA(RRtminittmret((s./usr/lib/python2.7/site-packages/salt/state.pyt	_mod_init%s#
cC@s�|jdd�}d|kr,|d}n|tkrH|dg}nt|t�s[|S|d|kr�|jd�r�dj|d�}||jkr�y'|j||||�}t|d<Wq�tk
r�tj	d|d�q�Xq�n|S(uQ
        Execute the aggregation systems to runtime modify the low chunk
        u
config.optionustate_aggregateu	aggregateustateu__agg__u{0}.mod_aggregateu(Failed to execute aggregate for state %s(
t	functionsR\R>RHR�RR�RMRNRO(RRtrunningR�tagg_opttagg_fun((s./usr/lib/python2.7/site-packages/salt/state.pyt_mod_aggregate8s 
 
cC@s$itd6gd6}i}d|jdkrJ|jdjd�|d<nd|kr�|j||�}|d|d<|dj|d�d|kr�|d|d<q�nd|kr |j||�}|dp�|d|d<|dj|d�d|kr |dp|d|d<q n|S(uR
        Check that unless doesn't return 0, and that onlyif returns a 0.
        uresultucommentushellugrainsuonlyifu
skip_watchuunless(RYRvR�t_run_check_onlyifRFt_run_check_unless(Rtlow_dataRRtcmd_optst_ret((s./usr/lib/python2.7/site-packages/salt/state.pyt
_run_checkMs"cC@sitd6}t|dt�s0|dg}n
|d}x�|D]�}t|tj�sx|jidd6td6�|S|jd|dtdt|�}tj	d|�|d	kr�|dtkr�|jid
d6td6td6�|S|d	krA|jidd6td6�qAqAW|S(
uR
        Check that unless doesn't return 0, and that onlyif returns a 0.
        uresultuonlyifu(onlyif execution failed, bad type passeducommentucmd.retcodetignore_retcodetpython_shelluLast command return code: %siuonlyif condition is falseu
skip_watchuonlyif condition is true(
RYR>RHRRVR�R�R\RNR�(RR�R�RRtlow_data_onlyifR�tcmd((s./usr/lib/python2.7/site-packages/salt/state.pyR�is&



"cC@sitd6}t|dt�s0|dg}n
|d}x�|D]�}t|tj�sx|jidd6td6�|S|jd|dtdt|�}tj	d|�|d	kr�|dtkr�|jid
d6td6td6�qA|d	krA|jidd6td6�|SqAW|S(
uR
        Check that unless doesn't return 0, and that onlyif returns a 0.
        uresultuunlessu*unless condition is false, bad type passeducommentucmd.retcodeR�R�uLast command return code: %siuunless condition is trueu
skip_watchuunless condition is false(
RYR>RHRRVR�R�R\RNR�(RR�R�RRtlow_data_unlessR�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR��s&



cC@s�itd6}i}d|jdkrC|jdjd�|d<nx�|dD]�}|jd|dtdt|�}tjd|�|d	kr�|dtkr�|jid
d6td6�qN|d	krN|jidd6td6�|SqNW|S(
uD
        Alter the way a successful state run is determined
        uresultushellugrainsu	check_cmducmd.retcodeR�R�uLast command return code: %siu(check_cmd determined the state succeededucommentu%check_cmd determined the state failed(RYRvR�R�R\RNR�R�(RR�RRR�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyt_run_check_cmd�s

cC@s
d|_dS(u-
        Rest the run_num value to 0
        iN(R�(R((s./usr/lib/python2.7/site-packages/salt/state.pyt
reset_run_num�scC@sj|jdkr3tjj|j|ji�|_n3tjj|j|j|j|jd|j	�|_dS(uU
        Read the state loader value and loadup the correct states subsystem
        uthoriumR�N(
R�RR�tthoriumRvR�R�RtserializersR�(R((s./usr/lib/python2.7/site-packages/salt/state.pyt_load_states�s$c	C@s�tjd�tjj|j�|_tjj|j|jd|jd|j�|_	t
|t�ra|jdt
�rat
|dtj�r�i|d|d6g}n&t
|dt�r�|d}ni}x�|D]�}xz|D]r}tjj|j|||j	�}|r�xA|D]6}dj|||jd��}|||j	|<qWq�q�Wq�Wqantjj|j�|_|j�tjj|j|j	d|jd|j�|_d	S(
u1
        Load the modules into the state
        u(Loading fresh modules for state activityRR�uproviderustateu{0}{1}u.R�N(RNR]RR�RRvtminion_modsR�R�R�R>R?R�RYRRVRHtraw_modRtrindexR�R�trenderR�Rw(	RR�R�t	providerstprovidertmodR�tfunctf_key((s./usr/lib/python2.7/site-packages/salt/state.pyR��s6
	



&
cC@s�tjd�|jdjd�dkrxytt�Wqxtk
rWtjd�qxtk
rttjd�qxXn|j	�|jjdt
�r�|jjdt�r�|jd�nd	S(
u)
        Refresh all the modules
        uRefreshing modules...ugrainsuosuMacOSuBError encountered during module reload. Modules were not reloaded.ulocalumultiprocessingusaltutil.refresh_modulesN(
RNR�RvR�RtsitetRuntimeErrorRORMR�RYR\R�(R((s./usr/lib/python2.7/site-packages/salt/state.pytmodule_refresh�s



+cC@s�t}|jdt�rJtjd�tjj|j�|jd<t}n|jdt�r�tjd�|j	�|jd<t}n|ds�|jdt�r�|j
�nd	S|jd
t�s�|r�|j
�d	S|ddkrk|d
dkr|djd�rh|j
�qhq�|d
dkr8|j
�q�|d
dkr�d|dkrh|j
�qhq�n|ddkr�|j
�nd	S(u�
        Check to see if the modules for this state instance need to be updated,
        only update if the state is a file or a package and if it changed
        something. If the file function is managed check to see if the file is a
        possible module type, e.g. a python, pyx, or .so. Always refresh if the
        function is recurse, since that can lay down anything.
        u
reload_grainsuRefreshing grains...ugrainsu
reload_pillaruRefreshing pillar...upillaruchangesuforce_reload_modulesNureload_modulesustateufileufunumanagedunameu.pyu.pyxu.pyou.pycu.sourecurseusymlinkubinupkguports(u.pyu.pyxu.pyou.pycu.so(upkguports(RYR�RNR�RR�RiRvR\R�R�tendswith(RR�RRt_reload_modules((s./usr/lib/python2.7/site-packages/salt/state.pyt
check_refresh�s8
	
	



	
c
C@sig}d|kr"|jd�nd|kr>|jd�nd|krZ|jd�n|dr�t|dtj�r�|jdj|dd|kr�d	j|d�nd
t|d�j��n|r�|S|dd|d}||jkrod|krV|jdj||d��|jj|�}|rl|jd
j|��qlq0|jdj|��n�t	j
jj|j|�}d}d}t|jt
�r�t|j�}nt|jt�r�t|j�}nxNt||�D]<}|j||kr�|jdj|j||��q�q�Wd
}	d|krKd}	nd|kr�dj|d�|jkr�d|kr�|dj|jd��n|jd�|d<d}	q�d}	n|	rex�||	D]�}
tt|
��}|d|kr�tj|d|
|�s.tj|d|
|�r^dj|d|
|d�}|j|�q^q�q�Wn|S(uR
        Verify the data, return an error statement if something is wrong
        ustateuMissing "state" dataufunuMissing "fun" dataunameuMissing "name" datau3ID '{0}' {1}is not formed as a string, but is a {2}u__sls__u
in SLS '{0}' uu.u&State '{0}' was not found in SLS '{1}'uReason: {0}u#Specified state '{0}' was not foundiu#Missing parameter {0} for state {1}urequireuwatchu
{0}.mod_watchu__id__u?Recursive require detected in SLS {0} for require {1} in ID {2}(RFR>RRVRR�RrR�tmissing_fun_stringRRRCtget_function_argspecRHR@tdefaultsttupleR
textendRR8R9tfnmatch(
RR�R�tfulltreasontaspectarglentdeflentindtreqdecR:R;R�((s./usr/lib/python2.7/site-packages/salt/state.pytverify_data!s~!"

			
cC@s�g}t|t�s%|jd�nt�}x�tj|�D]�\}}y|jd�rbw>nWntk
rvnXt|tj�s�|jdj	||dt
|�j��nt|t�s�dj	||�}|j|�q>nx�|D]�}|jd�rq�n||dkrA|jdj	||d|��q�nt||t
�st|jdj	||d��q�d}d	|kr�|d
7}nx�||D]�}	t|	tj�r�|d
7}d|	j�krl|jdj	|	||d��qlq�t|	t�r�tt|	��}
|
d
kr[t|	|
t
�s[|jdj	||d��q[n|
dkrlt|	|
t
�s�|jdj	|
||d��n�td|�||<x{|	|
D]o}t|tj�r�i|d6}nt|t�sdj	||d�}|j|�q�ntt|��}||}
d	|krv|jdj	|||d||jd	� ��nt|
�s�|jdj	|
��q�n||||
<|
|kr�|||
kr*||
||kr'||
d|||
kr$dj	|d||
�}|j|�q$q'q*q�q�Wtt
|	��d
kri|jdj	||d��qiqlq�q�W|s�|dks�|dkr�q�n|jdj	||d��q�|d
kr�|jdj	||d��q�q�Wq>W|S( uT
        Verify that the high data is viable and follows the data structure
        u,High data is not a dictionary and is invalidu__uXID '{0}' in SLS '{1}' is not formed as a string, but is a {2}. It may need to be quoted.u__sls__u4The type {0} in {1} is not formatted as a dictionaryu�ID '{0}' in SLS '{1}' contains a short declaration ({2}) with a trailing colon. When not passing any arguments to a state, the colon must be omitted.u0State '{0}' in SLS '{1}' is not formed as a listiu.iu u�The function "{0}" in state "{1}" in SLS "{2}" has whitespace, a function with whitespace is not supported, perhaps this is an argument that is missing a ":"unamesuMThe 'names' argument in state '{0}' in SLS '{1}' needs to be formed as a listurequireuwatchuprerequ	onchangesuJThe {0} statement in state '{1}' in SLS '{2}' needs to be formed as a listRuiduMRequisite declaration {0} in SLS {1} is not formed as a single key dictionaryuuInvalid requisite type '{0}' in state '{1}', in SLS '{2}'. Requisite types must not contain dots, did you mean '{3}'?u3Illegal requisite "{0}", please check your syntax.
ustateu<A recursive requisite was found, SLS "{0}" ID "{1}" ID "{2}"uEMultiple dictionaries defined in argument of state '{0}' in SLS '{1}'u0No function declared in state '{0}' in SLS '{1}'u7Too many functions declared in state '{0}' in SLS '{1}'N(urequireuwatchuprerequ	onchanges(R>R?RFR	RRGRPR�RVRR�RrRZRHR�R8R9R�RnR@(RRBR�R�RR�R�RRRKR�R:R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�{s�	

 







	cC@s1g}x$|D]}|j|j|��q
W|S(uD
        Verify the chunks in a list of low data structures
        (RR
(RR�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyt
verify_chunkss
cC@sqd}xi|D]a}d|kr
t|dt�s8q
n|d}||dkrn|dkrn|d}qnq
q
Wx�|D]�}d|kr�||d<qynt|dttf�s�|ddkr�|d|d<q�|ddkr�d|d<q�||d<nd|kr-|d|jd�d	|d<n|ddkry|d|d|d<qyqyW|jd
d��|S(ux
        Sort the chunk list verifying that the chunks follow the order
        specified in the order options.
        iuorderiidulasti@Bufirstu
name_orderg��@R�cS@s|ddj|�fS(Nuorderu{0[state]}{0[name]}{0[fun]}(R(R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�@s(R>R�R�RR�(RR�R�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�"s0





"cC@s�g}x�tj|�D]�\}}|jd�r7qnx�tj|�D]�\}}t�}g}	|jd�rwqGni|d6|d6}
|dk	r�||
d<nd|kr�|d|
d<nd|kr�|d|
d<n||
d<x�|D]�}t|tj�r|j|�q�nt|t�r�x�tj|�D]�\}}
|dkr�xu|
D]"}||	krX|	j	|�qXqXWq9|dkr�q9q9|dkr�t|
tj�r�||
|<q9|
|
|<q9Wq�q�W|	r�d	}x�|	D]�}t
j|
�}t|t�rGttj
|��}||d<tt|j||��n
||d<||d
<|d	7}x%|D]}||d<|j	|�qlWq�WqGt
j|
�}x%|D]}||d<|j	|�q�WqGWqW|j|�}|S(
u�
        "Compile" the high data as it is retrieved from the CLI or YAML into
        the individual state executor structures
        u__ustateunameu__orchestration_jid__u__sls__u__env__u__id__unamesiu
name_orderufunN(RRGRPR=RZR>RVRAR?RFR�R�R8R�RHRR�R�(RRBtorchestration_jidR�RR�RR�R�R�R�RKR�R�R�R�R�R�R�R((s./usr/lib/python2.7/site-packages/salt/state.pyR�Csl	
















cC@sg}d|kr||fS|jd�}x�|D]�}x�tj|�D]�\}}||kr�td�|D��}t|||�}t|�dkr�|jdj||jdd�|jdd���qHq�|dd}nxtj|�D]�\}	}
|	j	d	�rq�n|	||kr:|
|||	<q�nx�|
D]�}t
}x~tt|||	��D]b}
t|tj
�r�t|||	|
tj
�r�|||	j|
�|||	j|
|�t}qhnt|t�rht|||	|
t�rhtt|��}|tt|||	|
��kr�|tkrg|||	|
|j||�n||||	|
<t}n|d
kr�tt|||	|
��dkr�||||	|
<q�qhqhW|sA|||	j|�qAqAWq�WqHWq2W||fS(uM
        Pull the extend data and add it to the respective high data
        u
__extend__cs@s$|]}|jd�s|VqdS(u__N(RP(t.0R`((s./usr/lib/python2.7/site-packages/salt/state.pys	<genexpr>�siu�Cannot extend ID '{0}' in '{1}:{2}'. It is not part of the high state.
This is likely due to a missing include statement or an incorrectly typed ID.
Ensure that a state with an ID of '{0}' is available
in environment '{1}' and to SLS '{2}'u__env__ubaseu__sls__iu__unameunames(RRRGR8RLR@RFRR�RPRYR
R>RVtinsertR\R?R9tSTATE_REQUISITE_KEYWORDSR(RRBR�textt	ext_chunkRR�t
state_typetidsRR�RKR�thindR�((s./usr/lib/python2.7/site-packages/salt/state.pytreconcile_extend�sZ


!0*$$	$(cC@s�d|kr|St�}t�}|jd�}x�|D]�}t|tj�r`|j|�nt|t�r8t|�dkr�q8nttj	|��}|dkr�|j|d�q�|dkr�|j|d�q�q8q8W|rrx�tj
|�D]r\}}|jd�rq�n|jdd�}	|	s8q�nx0|D](}
t
j
|	|
�r?|j|�q?q?Wq�Wnx*|D]"}||kry|j|�qyqyW|S(ui
        Read in the __exclude__ list and remove all excluded objects from the
        high data
        u__exclude__iuslsuidu__u__sls__u(R=RR>RRVRAR?R@R8R�RGRPR�R(RRBR�R�R�R�R�RR�RQtex_R((s./usr/lib/python2.7/site-packages/salt/state.pyR��s<		


c#
C@s8
ddddddddh}|jd	d
ddd
h�}i}g}x	tj|�D]n	\}}t|t�syqXnxJ	tj|�D]9	\}}	|jd�r�q�nx	|	D]
	}
t|
t�r�t|
�dkr�q�ntt|
��}||krq�n|j	d�d}|
|}
t|
t�r�x�tj|
�D]p\}}t
}||krlt�||<nd|kr�|jdj
||||d||jd� ��|j	d�d}n|||kr�g|||<n|d||d<|d||d<xstt|||��D]W}tt||||��|kr!|||||ji||6�t}q!q!W|r�q>n|||jii||6g|6�q>Wnt|
t�r�	g}x�|
D]�}t|t�s�||kr2g||D]}|jd�s�|^q�}i||d6}q�t
}x�t|�D]�}x�gt||�D]}|jd�s_|^q_D]i}x`t|||�D]J}t|t�r�d|kr�|d|kr�i||6}t}q�q�q�Wq~WqEW|s�q�q�nt|�dkrq�ntt|��}||}|dkrPt||�}n|j||f�d|kr�|jdj
||||d||jd� ��|j	d�d}nx�|D]�}|\}}|dkrC||kr�t�||<n|||krg|||<n|||jii||6gd6�n|dkr�t|||�}xw|D]o\}}||kr�t�||<n|||kr�g|||<n|||jii||6gd6�qhWq�n|dkrAt|||�}x9|D]1\}}|sqnt|||�}||krLt�||<n|||krmg|||<n|j|�}x�|||D]�}
t|
t�s�q�nt|
�dkr�q�ntt|
��|kr�q�nttj|
��dkr�q�nttj|
��dkrq�n|||j|
�q�WqWq�n|dkr�t|||�}x9|D]1\}}|s~qfnt|||�}||kr�t�||<n|||kr�g|||<n|j|�}x�|||D]�}
t|
t�sq�nt|
�dkrq�ntt|
��|kr<q�nttj|
��dkr]q�nttj|
��dkr~q�n|||j|
�q�WqfWq�nt
}||kr�t�||<n|||kr�g|||<n|d||d<|d||d<xstt|||��D]W}tt||||��|kr#	|||||ji||6�t}q#	q#	W|r�	q�n|||jii||6g|6�q�Wq�Wq�	q�q�Wq�WqXWg|d<x5tj|�D]$\}} |dji| |6�q�	W|j|�\}!}"|j|"�|!|fS(uG
        Extend the data reference with requisite_in arguments
        u
require_inuwatch_inu	onfail_inuonchanges_inuuseuuse_inuprerequ	prereq_inurequireuwatchuonfailuonfail_stopu	onchangesu__iu_iu.ujInvalid requisite in {0}: {1} for {2}, in SLS '{3}'. Requisites must not contain dots, did you mean '{4}'?u__sls__u__env__unameuslsuprerequiredunamesu
__extend__(tunionRRGR>R?RPR@R8R9RRYR	RFRR�R
R\RHRURLRER�RR(#RRBtreq_int
req_in_allRR�RR�RR�RKR�trkeytitemst_stateRtfoundRthingesR`t	_ind_hight_idtjtpstatetpnamettuptext_idsRIt
_req_statetext_argstignore_argstloc_argsR�treq_in_hight
req_in_errors((s./usr/lib/python2.7/site-packages/salt/state.pytrequisite_in�s\

!


	

!
2

cC@s�tjj�}t|�}y&|j|d|d|d�}Wnctk
r�}tjd|dtj�t	j
�}itd6|d6id6d	j|�d
6}nXtjj�}	|	|}
|
j
d|
jd}||d
<tjj|jd|j�}tjj|tjjj|��}
tjj|�s_ytj|�Wq_tk
r[q_Xntjjj|
d��}|jt|��WdQXdS(uZ
        The target function to call that will create the parallel thread/process
        ufulluargsukwargsu'An exception occurred in this state: %stexc_info_on_logleveluresultunameuchangesu(An exception occurred in this state: {0}ucommenti@Bg@�@udurationucachediruwb+N(R"R#RR�R�RNR�tloggingtDEBUGt	tracebackt
format_excRYRR'R(R0R1R2RvR�RRt	hashutilstsha1_digestR3R4tOSErrorRtfopentwritetmsgpack_serialize(RRRoRR)RRRR�ttrbR+R-R.ttrootttfiletfp_((s./usr/lib/python2.7/site-packages/salt/state.pyt_call_parallel_target�s:


	
c	C@s�|jd�pd
gdp,|djd�}|sS|jd|jd��}ntjjjd|jd|||f�}|j�i|d6d
d6id	6d
d6|d6}|S(uG
        Call the state defined in the given cdata in parallel
        uargsiukwargsunameu__id__ttargetRCuresultuchangesuStarted in a separate processucommentuprocN(R�RZRRtprocesstMultiprocessingProcessR?tstart(RRoRRtprocRR((s./usr/lib/python2.7/site-packages/salt/state.pyt
call_parallel�s	/	


u
content_checkuunifyic
C@s�	tjj�}|tjj�tjj�}tjdt|dtj�r^|dj�n|d|j	�j
��|j|�}|ritd6|dd6id6dd6}x'|D]}	|dcdj
|	�7<q�W|j|d<|jd	7_t|�|j||�|Sitd6|dd6id6}|jd
d/�|jd
<|ddkrd
|kr|d
|jd<n|jdd/�|jd<|jd�s�tjd|d|dt|dtj�r�|dj�n|d�nd|kr|j|�ndj
|�}
tjjj|j|
|di|
d6dt�}itj|�d6|rwtj|�nid6|jd6|r�tj|�nid6}d|kr�tj|d�|d<n|jr�|j |j�n|jd�r?t!j"|j|dj#j$d}
t%t!j"|j|dj#j$d<nz�yd|kridj
|�|jks�d|kr�dj
|�|jkr�|j |j&|��n|j'jd t�s$d!|kr�tj|d!�|d<q$t|d"jd#d/�tj�r$tj|d"d#�|d<q$nd|kr=d$|d<nd%|krZ|d%|d%<nd|ksv|dtkr||j_|j(r�t)|�}nc|jd�r�|jd&�r�|j*||�}n/|j+|�|j|d|d'|d"�}i|j_nd(|krId)j
|�|jkrI|j |j,|��nWn�t-k
r}tj.d*|d+t/j0�t1j2�}|jd'�p�d/gd,p�|d"jd�}|s�|jd|jd-��}nitd6|d6id6d.j
|�d6}nXWd/|jd�r;|
t!j"|j|dj#j$d<n|jj3d
d/�|jj3dd/�Xt|t4�su|Sd0|kr�|j5d0g�j6|d0�nd|kr�|j�n|jd�r�t|d<|S|jd1�|d1<|j|d<|jd	7_t|�|j||�tjj�}tjj�tjj�}||}||}|j	�j
�|d2<||}|j7d3|j8d4}||d5<|d-|d-<tjd6t|dtj�r�|dj�n|d|j	�j
�|�d7|kr�	|j9|d7�|d7<t!j"|j|dj#j$ds�	|d7d8|dkr�	|d7d9|kr�	|d7d:}|d7d;d,kr�|t:j;d,|d7d;�}ntjd<|�|j<d=|�|j=|||d>|d	�}|}|}d?j>d@j
||d|d�|ds+	dn|dg�|d<|d5|d5|dA|d5<|d	kr}	|d2|d2<q}	q�	q�	q�	dBj>|ds�	dn|ddCj
|d7d9|d7d:|d7d8|d7d;�g�|d<n|S(Duk
        Call a state directly with the low data structure, verify data
        before processing.
        uRunning state [%s] at time %sunameuresultuchangesuucommentu{0}
u__run_num__iurunasustateucmdupasswordurunas_passwordu
__prereq__uExecuting state %s.%s for [%s]ufunuprovideru{0[state]}.{0[fun]}tinitial_retufulltexpected_extra_kwsu__low__u__running__u__instance_id__u__lowstate__u__env__utestuunlessu{0[state]}.mod_run_checkuonlyifulock_saltenvusaltenvukwargsuenvubaseu__orchestration_jid__uparalleluargsu	check_cmdu{0[state]}.mod_run_check_cmdu'An exception occurred in this state: %sR0iu__id__u(An exception occurred in this state: {0}Nuwarningsu__sls__u
start_timei@Bg@�@udurationu3Completed state [%s] at time %s (duration_in_ms=%s)uretryuuntiluattemptsuintervalusplayuQState result does not match retry until value, state will be re-run in %s secondsu
test.sleeptretriesu
uJAttempt {0}: Returned a result of "{1}", with the following comment: "{2}"i�u  u�The state would be retried every {1} seconds (with a splay of up to {3} seconds) a maximum of {0} times or until a result of {2} is returned(?R"R#R$RNR]R>RRVR�R%R&R
RYRR�RdR�R�RZR�R�RRRCtformat_callR�tSTATE_INTERNAL_KEYWORDStimmutabletypestfreezeR�R[R�R�tsystmodulesRst__opts__R\R�RvR�RpREtformat_slotsR�R�R�R1R2R3R4RR?t
setdefaultRR'R(tverify_retry_datatrandomtrandintR�tcallR2(RRR�R�RHR)R*R�RRR�tstate_func_nameRoR�ttestR�R;RR+ttimezone_deltatlocal_finish_timeR-R.tintervalt	retry_rettorig_ret((s./usr/lib/python2.7/site-packages/salt/state.pyRUs6 	&



&

	
	"%	$$"!
	

$
/% 







&"!
$cC@s�tjd|�|jdd�}t|�dkrHtjd|�|S|ddkrytjd|�tjd�|Stjjj|d�\}}}|s�||j	kr�tjd|�tjd	�|Stjd
|||�|j	|||�S(NuEvaluating slot: %su:iiuMalformed slot: %siusaltukOnly execution modules are currently supported in slots. This means slot should start with "__slot__:salt:"u[Execution module should be specified in a function call format: test.arg('arg', kw='kwarg')uCalling slot: %s(%s, %s)(
RNR�RR@twarningRRRCtparse_functionR�(RtslottfmtRRCR|((s./usr/lib/python2.7/site-packages/salt/state.pyt__eval_slot�s 
"
cC@s�dt|d�fd|dj�ff}x�|D]~\}}xo|D]g\}}tjjj|dt�}t|tj	�sF|j
d�r�qFn|j|�|||<qFWq3WdS(u�
        Read in the arguments from the low level slot syntax to make a last
        minute runtime call to gather relevant data for the specific routine
        uargsukwargstkeepu	__slot__:N(t	enumerateRRRR�R�R\R>RR[RPt_State__eval_slot(RRotctxtatypetavaluesRRK((s./usr/lib/python2.7/site-packages/salt/state.pyRPscC@s�itd6dd6dd6dd6}itd6td6td6td6}i}t|t�r�x�tj|�D]r\}}||kr�t|||�r�||||<q�tjd|||�||||<qi||||<qiWntjd	�|}|S(
u3
        verifies the specified retry data
        uuntiliuattemptsiusplayiuintervaluFAn invalid value was passed for the retry %s, using default value '%s'udState is set to retry, but a valid dict for retry configuration was not found.  Using retry defaults(	R\tboolR�R>R?RRGRNR](Rt
retry_datatretry_defaultst
expected_datatvalidated_retry_datatexpected_keyt
value_type((s./usr/lib/python2.7/site-packages/salt/state.pyRRs0


cC@s�i}d|jdkr�x�|D]�}dj|d|d�}x�|jddD]�}tj||�rSdj||�}t|�}iid6td6|d	6|jd
6|dd6||<|jd7_|j|�PqSqSWq!Wni}x�|D]�}d
|kr|jd
�|St|�}	|	|kr}|j|�}
|
dkrOPn|j	|||�}|j
||�r}|Snt�|_q�Wx*t
r�|j|�r�Pntjd�q�Wtt|j��t|j���}|S(uU
        Iterate over a list of chunks and call them, checking for requires.
        ustate_runs_disabledugrainsu{0}.{1}ustateufunu\The state function "{0}" is currently disabled by "{1}", to re-enable, run state.enable {1}.uchangesuresultucommentu__run_num__u__sls__iu__FAILHARD__ukillg{�G�z�?(RvRRRRYR�tremoveRtcheck_pauset
call_chunktcheck_failhardR=R�R\treconcile_procsR%tsleepR?RHR(RR�tdisabledRtstate_tpattcommentt_tagR�RtactionRR((s./usr/lib/python2.7/site-packages/salt/state.pytcall_chunksAsL	




	(cC@sst|�}|jjdt�r%tS|jd|jd�ro||kro||ddkrbtS||dStS(uK
        Check if the low data chunk should send a failhard signal
        utestufailharduresultN(RRvR�RYRZ(RRR�R((s./usr/lib/python2.7/site-packages/salt/state.pyRrrs%
c	C@s�|js
dStjj|jdd|j�}tj�}tjj|�r�y2x+tr}d}tj	j
j|d��}yt|j
��}Wn>tjk
r�|dkr�dS|d7}tjd�wSnX|d}d	}||kr�|}nd
|krd
}n|rcd||krLtj�}	|	|||dkrLdSnd
||krgd
SndStjd�WdQXqSWWq�tk
r�}
tjd|�dSXndS(u@
        Check to see if this low chunk has been paused
        Nucachedirustate_pauseiurbi
iu__id__uu__all__udurationurunukillu4Failed to read in pause data for file located at: %s(R�R0R1R2RvR%tisfileR\RRRR8tmsgpack_deserializetreadtmsgpacktUnpackValueErrorRtR�RNRO(RRt
pause_pathRCttriesR>tpdatRR�R$R�((s./usr/lib/python2.7/site-packages/salt/state.pyRpsH	"	


		cC@sit�}xS|D]K}||jd�}|r|j�sKtjj|jd|jtj	j
j|��}tjj|�s�it
d6dd6||dd6id6}ny7tj	jj|d��}t|j��}Wd	QXWnAttfk
r%it
d6d
d6||dd6id6}nX||j|�||jd�q[|jt
�qqWt
|kS(uG
        Check the running dict for processes and resolve them
        uprocucachediruresultu!Parallel process failed to returnucommentunameuchangesurbNuParallel cache failure(R=R�tis_aliveR0R1R2RvR�RRR5R6R|RYRR8R}R~R7tIOErrorR�RRA(RR�tretsetRRDt	ret_cacheRRR>((s./usr/lib/python2.7/site-packages/salt/state.pyRs�s4	
	



c	C@s�t}d|krvdj|d�|jkrmd|krW|dj|jd��qs|jd�|d<qvt}nd|kr�dj|d�|jkr�d|kr�|dj|jd��q�|jd�|d<q�t}nd|kr�t}nd|krt}nd|kr%t}nd|kr:t}nd	|krOt}nd
|krdt}nd|kryt}nd|kr�t}n|s�d
dfS|j|�i	gd6gd6gd6gd6gd6gd	6gd
6gd6gd6}|rg|d<nx�|D]�}||kr
||d k	r
x�||D]�}t|t	j
�r_i|d6}nt|�}t}	x`|D]X}
tt
|��}||}|d kr�qxn|dkr�tj|
d|�rxt}	||j|
�qxqxny�t|t	j
�rktj|
d|�s/tj|
d|�rq|dksK|
d|krht}	||j|
�qhqqnt�Wqxtk
r�}
tdj||
d���qxtk
r�tdj||
d���qxXqxW|	s7dd!fSq7Wq
q
Wt�}xt	j|�D]�\}}t�}|jd�rH|jd�rH|j}n|}x*trz|j|�rjPntjd�qQWx�|D]�}
t|
�}||kr�|jd�q�n|jd	�r�||dtkr|jd	�q�qn'||dtkr|jd�q�n|jd�rS||ds@|jd�q�|jd�q�n|jd�r�||dr�|jd�q�n|jd�r�||dd kr�|jd�s�|jd�q�n|jd�r
||dd k	r
|jd�s3|jd�q3q�||jdt�r�|jd
�q�q�W|jd�r�d
|ks^d|kr}d|kr}|jd�q}nd|kr�d|kr�|jd�nd|kr�|jd�q�nd	|kr�d|kr�|jd	�q�q�n|j|�qWd|krd}n�d|kr-d}n�d|krWd|krNd
}q�d}n]d	|krxd
|krxd	}n<d|kr�d|kr�d}nd|kr�d}nd
}||fS("u`
        Look into the running data to check the status of all requisite
        states
        uwatchu
{0}.mod_watchustateurequireu	watch_anyurequire_anyuprerequireduprerequonfailu
onfail_anyu	onchangesu
onchanges_anyumetuiduslsu__sls__unameu__id__uDCould not locate requisite of [{0}] present in state with name [{1}]uunmetg{�G�z�?uresultufailuchangesuonchangesmetuchangeupremetupreu
__state_ran__u_any(N((RYRR�RRR\RsRZR>RRVR<R8R9RRFR�RRMR=RGRPR�R%RtRRAR�R�RoR�(RRR�R�R�tpresentR�tr_stateR:R R�R�R�R�t	fun_statst	req_statstrun_dictRtstatus((s./usr/lib/python2.7/site-packages/salt/state.pytcheck_requisite�s$										








			


	


##							c	@sn�jjd�rj�jjdt�s.|rj�jjd�sUd�fd�}n
�jd}i|d6}|tkr�tjjj�j	�jdt
j|d�gd	�}n�t|t
j
�r�tjjj�j	�jdt
j|�gd	�}nEtjjj�j	d
�jdt
j|d�gd�}||d
<i�j	d6}|||d|�ndS(u
        Fire an event on the master bus

        If `fire_event` is set to True an event will be sent with the
        chunk name in the tag and the chunk result in the event data.

        If `fire_event` is set to a string such as `mystate/is/finished`,
        an event will be sent with the string added to the tag and the chunk
        result in the event data.

        If the `state_events` is set to True in the config, then after the
        chunk is evaluated an event will be set up to the master with the
        results.
        ulocalustate_eventsu
master_uric@s2tjjj�j�jddt�j||�S(Nusock_dirtlisten(RRteventtget_master_eventRvRYt
fire_event(RRRtpreload(R(s./usr/lib/python2.7/site-packages/salt/state.pyR��	suevent.fire_masteruretuidunameustate_resultuprogu__run_num__ujobulenujidR�N(RvR�R\RZR�RRR�ttagifyR�RR[R>RV(Rt	chunk_rettlengthR�tev_funcRRRR�((Rs./usr/lib/python2.7/site-packages/salt/state.pyR�x	s .

/+/
cC@s�
|j|||�}|j|�t|�}|jd�sP|jj|�ndddddddd	d
g	}|jd�s�|jd�|j|||dt�\}}n|j|||�\}}|d
kr4i}g}x�|D]�}	g||	<|	|kr
q�nx�||	D]}}
t	|
t
j�r@i|
d6}
nt|
�}
t
}tt|
��}|
|}
x
|D]}|
d9kr�qun|dkr�tj|d|
�ru|	dkr�t|d<n|j|�t}ququntj|d|
�stj|d|
�ru|dks,|d|krw|	dkrEt|d<n|	dkr^t|d<n|j|�t}qwququW|s||	j|
�qqWq�W|ds�|ds�|ds�|ds�|d	s�|jd�rd}x�t
j|�D]x\}	}|sq�n|djd:|	�7}xG|D]?}tt|��}||}
|djdd||
�7}q)Wq�W|jd�r�|j}n|}t�\}}iid6t
d6|d6|d6|d6|jd 6|dd6||<|jd!7_|j||t|�d"|jd#��|SxH|D]@}t|�}||kr%||jkr-|jd�r�||jkr�t|d<|j|||�|j|<|S|SnP||kr�tjd$�iid6t
d6d$d6|jd 6|dd6||<n|jd!7_|j||t|�d"|jd#��|S|j|||�}|j||�ret|d%<|Sq%q%W|jd�r�|j|||�\}}|j|||�|j|<|j|dr|d&kridd6|j|d<d9|j|d<qn|j|||�}|j||�ry
t|d%<|SnE|d'kr�|jd�rn|j|||�|j|<qy
|j|||�||<n�|d(kr"||jkr�|j|||<|j||d <|d||d<n4t�}x�t
j|�D]�}x�|D]�}t|�}|jj||j|��}|d9krDqn|dt
krd)jd*|dd+|d�}|j|�qqWq�Wd,jd-j d.�|D���}t�\}}iid6t
d6|d6|d6|d6|jd 6|dd6||<|||j|<|jd!7_nW|d&kr�|jd�r�|j|||�}|dr�|jd/t
�r�|j!�}|d0|d1<d2|d0<||d3<|j|||�}n|||<n�|d4krF	t�\}}iid6td6|d6|d6d5d6|jd 6|dd6}|||<||j|<|jd!7_n3|dkr�	t�\}}iid6td6|d6|d6d6d6t
d76|jd 6|dd6||<|jd!7_n�|d	kr2
t�\}}iid6td6|d6|d6d8d6t
d76|jd 6|dd6||<|jd!7_nG|jd�r`
|j|||�|j|<n|j|||�||<||kr�
|j||t|�d"|jd#��n|S(;ud
        Check if a chunk has any requires, execute the requires and then
        the chunk
        uprerequiredurequireurequire_anyuwatchu	watch_anyuprerequonfailu
onfail_anyu	onchangesu
onchanges_anyu
__prereq__R�uunmetuiduslsu__sls__unameu__id__ustateu__prerequired__u)The following requisites were not found:
u{0}{1}:
u iu{0}{1}: {2}
iuchangesuresultudurationu
start_timeucommentu__run_num__iR�u
fire_eventuRecursive requisite foundu__FAILHARD__uchangeumetufailu{sls}.{_id}RQR#u!One or more requisite failed: {0}u, cs@s|]}tj|�VqdS(N(RR[(Rti((s./usr/lib/python2.7/site-packages/salt/state.pys	<genexpr>B
su
skip_watchufunusfunu	mod_watchu__reqs__upreuNo changes detectedu3State was not run because onfail req did not changeu
__state_ran__u<State was not run because none of the onchanges reqs changedNu                   ("R�R�RR�R�RARFR�R\R>RRVR<RYR8R9RZRRGRR�R/R�R�R@RURNRORqRrR=RXR2R�(RRR�R�Rt
requisitesR�R�tlostt	requisiteR:R R�R�R�RxtlreqstlreqR�R,R.tctagtfailed_requisitestreq_lowstreq_lowtreq_tagtreq_retR�t_cmtRRtpre_ret((s./usr/lib/python2.7/site-packages/salt/state.pyRq�	s�
	
$





	




"

)



)

	













,c@s�g}i}x�|D]�}|||d|d|df<d|krt|ji|d|d|d|df6�nd|krxd|dD]U}xLtj|�D];\�}|jii|d|d6g�|df6�q�Wq�WqqWg}i}	x/|D]'}
xtj|
�D]
\�}x�|D]�}t|t�s�t}xL|D]D}|d|kso|d|krIi|d|d6}t}qIqIW|s�q'q�nxztj|�D]i\��t��fd�|D��s8iidj���d	6d
j���d6td6id6t	���6}
|	j
|
�q�ngtj|�D]4\}}�|d
krH�|krHt|�^qH}x�|D]�}||kr�q�n||dr�t�fd�|D��s@iidj�d
�d�d	6d
j�d
�d�d6td6id6t	�d
�d�6}
|	j
|
�q�ngtj|�D]6\}}�d
|d
krP�d|krP|^qP}x�|D]{}|j�}|d|d<d|d<dj|d�|d<x*t
D]"}||kr�|j|�q�q�W|j|�q�Wq�q�Wq�Wq'WqWq�W|j|�}|j
|�x.|	D]&}|j|	|d<|jd7_qLW|j
|	�|S(uX
        Find all of the listen routines and call the associated mod_watch runs
        ustateu__id__unameulistenu	listen_inulookupc3@s+|]!}�|dko"�|kVqdS(iN((Rtcref(tlkeytlval(s./usr/lib/python2.7/site-packages/salt/state.pys	<genexpr>�
su(Referenced state {0}: {1} does not existucommentulisten_{0}:{1}uresultuchangesic3@s3|])}�d|dko*�d|kVqdS(iiN((RR�(R�(s./usr/lib/python2.7/site-packages/salt/state.pys	<genexpr>�
siufunusfunu	mod_watchulistener_{0}u__run_num__(RFRRGR>R?RYR\tanyRR!R�RR�RRR{R�(RR�R�t	listenerstcrefsR�tl_inR�tmod_watchersR�tl_dictt	listen_toR trerrorR�R�tto_tagstto_tagt
new_chunksRR:RRR�((R�R�R�s./usr/lib/python2.7/site-packages/salt/state.pytcall_listen�
s�
0>



	
J

L


(


c
@sHg}�j|�\}}|j|�|j�j|��|rH|S�j|�\}}|j|��j|�}|r�|S�j||�}|r�|S�j|�}�j||�}�fd�}|��jdk	rDt
jj�j
dd�j�}	t
jj|	�rDyt
j|	�WqAtk
r=qAXqDn|S(uI
        Process a high data call and ensure the defined states.
        c@sntjjt�jd��j�}y!tj|�tjd|�Wn!t	k
ritjd|�nXdS(Nucachediru Deleted accumulator data file %su*File %s does not exist, no need to cleanup(
R0R1R2R7RvR�RoRNR�R7(taccum_data_path(R(s./usr/lib/python2.7/site-packages/salt/state.pyt_cleanup_accumulator_data�
s	

ucachedirustate_pauseN(RRR�R/R�R�R{R�R�RZR0R1R2RvR|RoR7(
RRBRR�t
ext_errorsR.R�RRR�R�((Rs./usr/lib/python2.7/site-packages/salt/state.pyt	call_high�
s4


"

c
C@slg}|s||fSt|t�sE|jdj|��||fSd
}x=|D]5}||krR|jdj||��||fSqRWx�|D]�}t||t�s(t||tj�r(d||kr||jd�}i|dg|d6||<q�n|jd	j||��q�q(nt�}x*t||�D]}	|	j	d
�r]qBn|||	dkr�|jdj|||	��qBnt|||	t�s�qBnd|	krM|	jd�}|d|kr�|jdj||��qBn||j|	�|||d<|||dj|d�|j
|d�qBn|j
|	�qBWq�W||fS(Nu,Template {0} does not render to a dictionaryuincludeuexcludeuextendsuOThe '{0}' declaration found on '{1}' is invalid when rendering single templatesu.iiu*ID {0} in template {1} is not a dictionaryu_u�ID '{0}' in template {1} contains a short declaration ({2}) with a trailing colon. When not passing any arguments to a state, the colon must be omitted.uPID '{0}' in template '{1}' contains multiple state declarations of the same type(uincludeuexcludeuextends(R>R?RFRRRVRR=R~RPRZRHRRA(
RRBR{R�t
invalid_itemsRDRR�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR}�
sd





		

cC@sit||j|jd|jd|jd�}|s:|S|j||�\}}|r\|S|j|�S(u2
        Enforce the states in a template
        urendererurenderer_blacklisturenderer_whitelist(RRwRvR}R�(RR{RBR�((s./usr/lib/python2.7/site-packages/salt/state.pyt
call_templateMs

cC@sit||j|jd|jd|jd�}|s:|S|j|d�\}}|r\|S|j|�S(uQ
        Enforce the states in a template, pass the template as a string
        urendererurenderer_blacklisturenderer_whitelistu<template-str>(RRwRvR}R�(RR{RBR�((s./usr/lib/python2.7/site-packages/salt/state.pytcall_template_str]s

N(1RrRsRtRZRYRyR�R�R�R�R�R�R�R�R�R�R�R�R
R�RR�R�RR�R/R?RERRt
decoratorsRt
OutputUnifierRURdRPRRR{RrRpRsR�R�RqR�R�R}R�R�(((s./usr/lib/python2.7/site-packages/salt/state.pyR��s`'	+								
"		*	Z	�			!A	D	(	�	+	�			%	1	
	-	 �'	�	I1	O	t
BaseHighStatecB@s"eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zed�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Zd�Zdddeddd�Zd�Zd�Zd�Z RS(u
    The BaseHighState is an abstract base class that is the foundation of
    running a highstate, extend it and add a self.state object of type State.

    When extending this class, please note that ``self.client`` and
    ``self.matcher`` should be instantiated and handled.
    cC@sR|j|�|_d|_|j�|_tjj|j�|_t	�|_
dS(Ni'(t_BaseHighState__gen_optsRvtiordert_BaseHighState__gather_availtavailRtpayloadtSerialtserialR	tbuilding_highstate(RRv((s./usr/lib/python2.7/site-packages/salt/state.pyRyvs
	cC@s7i}x*|j�D]}|jj|�||<qW|S(uH
        Gather the lists of available sls data from the master
        (t	_get_envstclienttlist_states(RR�Rj((s./usr/lib/python2.7/site-packages/salt/state.pyt__gather_avail}scC@smd|kr|dr|Sn|jj�}t|t�s�d|d<t|d<tjjjd�|d<i|d<it	j
gd6|d	<n�|d|d<|jdt�|d<|djd
�r�|d|d<nT|djd�rtjjj|dd�|d<ntjjj|d�|d<|jd
d�|d
<|jdi�|d<|jd|d�|d<|d	|d	<|jd|jd��|d<|jd|jdg��|d<|jd|jd��|d<|jd�|d<|jd|jdt��|d<|jdi�|d<|jdi�|d<|jdt�|d<|jdt�|d<|S(u�
        The options used by the High State object are derived from options
        on the minion and the master, or just the minion if the high state
        call is entirely local.
        ulocal_stateu
jinja|yamlurendererufailhardutop.slsu	state_topu
nodegroupsubaseu
file_rootsusalt://u/iustate_top_saltenvustate_auto_orderutop_file_merging_strategyu	env_orderudefault_topustate_eventsustate_aggregateu	jinja_envu
jinja_sls_envujinja_lstrip_blocksujinja_trim_blocksN(R�RgR>R?RYRRturltcreatetsyspathstBASE_FILE_ROOTS_DIRR�RPRZ(RRvtmopts((s./usr/lib/python2.7/site-packages/salt/state.pyt
__gen_opts�sD	



$	""cC@s"dg}d|jkrT|jgt|jd�D]}||kr2|^q2�n|jjdg�}t�}g|D]'}||kp�|j|�sy|^qy}|jj�}|r�|r�g|D]}||kr�|^q�S|r�|S|jg|D]}||kr�|^q��|SdS(uM
        Pull the file server environments out of the master options
        ubaseu
file_rootsu	env_orderN(RvRRHR�R=RAR�tenvs(RR�R`t	env_ordertmemberstenvtclient_envs((s./usr/lib/python2.7/site-packages/salt/state.pyR��s	 	4#,cC@sJtt�}tt�}tt�}d}|jd}|dkrp|jdrp|jdsptd��qpn|jdr|jj|jd|jd�}|rd}t||jj|jjd	|jjd
|jjdd|jd�g||jd<qgig||jd<nJd}|jj	d
t
�}|rct|tj
�rctj|�}nx�|ru|gn	|j�D]�}|jj|jd|�}|r|d}||jt||jj|jjd	|jjd
|jjdd|��q||ji�tjd|�qW|dkrg|dkrg|jj	dd�rgtjd|�n|dkr�tjdt|jjd��nxstj|�D]b\}}	xS|	D]K}
d|
kr�q�nx#|
dD]}||j|�q�W|
jd�q�Wq�Wx7|rEg}x�tj|�D]�\}}
|j|�|
sPq+nx�|
D]�}x�tj|j||�D]�}|||kr�qwn||jt|jj||�j	dt
�|jj|jjd	|jjd
|jjd|��||j|�qwWqWWq+Wx*|D]"}||kr|j|�qqWqW|S(u&
        Gather the top files
        iutop_file_merging_strategyusameusaltenvudefault_topuXtop_file_merging_strategy set to 'same', but no default_top configuration option was setu	state_topiurendererurenderer_blacklisturenderer_whitelistRjustate_top_saltenvu#No contents loaded for saltenv '%s'umergeu	env_orderutop_file_merging_strategy is set to '%s' and multiple top files were found. Merging order is not deterministic, it may be desirable to either set top_file_merging_strategy to 'same' or use the 'env_order' configuration parameter to specify the merging order.u�No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/master' are accessible. The 'file_roots' configuration is: %su
file_rootsuincludeudestN(R
RHRvRR�t
cache_fileRRRwR�RYR>RRVR[R�RFRNR�RZR]treprRGRRtfilterR�t	get_state(RttopstincludetdoneR tmerging_strategytcontentststate_top_saltenvRjtctopstctopRQtpopsR�t	sls_match((s./usr/lib/python2.7/site-packages/salt/state.pytget_tops�s�


	
	

!	
	

	


.

	

 
				




cC@s�|jd}y\dj|�}t||�}t|d�shdj|�}tj|�t|��nWn0ttfk
r�tjd|�|j	}nX||�S(u-
        Cleanly merge the top files
        utop_file_merging_strategyu_merge_tops_{0}u__call__u'{0}' is not callableu?Invalid top_file_merging_strategy '%s', falling back to 'merge'(
RvRR�thasattrRNRORMR�R]t_merge_tops_merge(RR�R�t
merge_attrt
merge_funcR^((s./usr/lib/python2.7/site-packages/salt/state.pyt
merge_topsEs


c
C@s�tt�}|jdtt��}x�|D]�}xztj|�D]i\}}|dkr_qAny+x$|D]}||||||<qiWWqAtk
r�td��qAXqAWq+Wx�tj|�D]�\}}	x�|	D]�}x�tj|�D]�\}}|dkr	q�nJ||kr.tjd||�q�n%||krStjd||�q�ny+x$|D]}||||||<q]WWq�tk
r�td��q�Xq�Wq�Wq�W|S(u�
        The default merging strategy. The base env is authoritative, so it is
        checked first, followed by the remaining environments. In top files
        from environments other than "base", only the section matching the
        environment from the top file will be considered, and it too will be
        ignored if that environment was defined in the "base" top file.
        ubaseuincludeu,Unable to render top file. No targets found.u�Section for saltenv '%s' in the '%s' saltenv's top file will be ignored, as the top_file_merging_strategy is set to 'merge' and the saltenvs do not matchu�Section for saltenv '%s' in the '%s' saltenv's top file will be ignored, as this saltenv was already defined in the 'base' top file(	R
R	RRRGRMRRNR�(
RR�ttopt	base_topsR�RjttargetsttgttcenvR�((s./usr/lib/python2.7/site-packages/salt/state.pyR�Ys@







cC@s�tt�}x�tj|�D]�\}}tg|D]}|ik^q2�rA|jd}|j|g�}tg|D]}|ik^qv�r�tjd||�qnx�|D]�}x}tj|�D]Y\}	}
|	|kr�q�ntj	d||�x$|
D]}||	|||	|<q�WPq�Wtjd||�q�Wqqx�|D]�}x�tj|�D]�\}	}
|	dkr|q^n%|	|kr�tj	d|	|�q^ny+x$|
D]}||	|||	|<q�WWq^t
k
r�td��q^Xq^WqHWqW|S(u�
        For each saltenv, only consider the top file from that saltenv. All
        sections matching a given saltenv, which appear in a different
        saltenv's top file, will be ignored.
        udefault_topumThe '%s' saltenv has no top file, and the fallback saltenv specified by default_top (%s) also has no top fileuDThe '%s' saltenv has no top file, using the default_top saltenv (%s)ulThe '%s' saltenv has no top file, and no matches were found in the top file for the default_top saltenv (%s)uincludeu�Section for saltenv '%s' in the '%s' saltenv's top file will be ignored, as the top_file_merging_strategy is set to 'same' and the saltenvs do not matchu,Unable to render top file. No targets found.(R
R	RRGRWRvR�RNROR�RMR(RR�R�R�R�R`tdefault_topt
fallback_topsR�RjR�R�((s./usr/lib/python2.7/site-packages/salt/state.pyt_merge_tops_same�sN%
%







c
C@s�d�}tt�}xdtj|�D]S}xJ|D]B}x9tj|�D](\}}|dkrfqHny�x�|D]�}|||kr�||||||<qpn||||�\}	}
||||�\}}g}
|p�|	}|dk	r|
j|�n|
j|
�|
jg|D]}||
kr|^q�|
|||<qpWWqHtk
rot	d��qHXqHWq2Wq%W|S(u>
        Merge the top files into a single dictionary
        cS@sad}g}xH|D]@}t|t�r1|}nt|tj�r|j|�qqW||fS(N(RZR>R?RRVRF(R�t
match_typeR�RD((s./usr/lib/python2.7/site-packages/salt/state.pyt	_read_tgt�s
	uincludeu,Unable to render top file. No targets found.N(
R
R	RRXRGRZRFRRMR(RR�R�R�R�R�RjR�R�tm_type1t	m_states1tm_type2t	m_states2tmergedR�R`((s./usr/lib/python2.7/site-packages/salt/state.pyt_merge_tops_merge_all�s0	



,
cC@s�g}t|t�s&|jd�|Sxmtj|�D]\\}}|dkrTq6nt|tj�s|jdj|��n|dkr�|jd�nt|t�s�|jdj|��nx�tj|�D]�}t|t�s�|jd�q�nx�|D]�}t|t�rVxptj|�D](}|s'|jdj||��q'q'Wqt|tj�r|s�|jd	j|��q�qqWq�Wq6W|S(
u:
        Verify the contents of the top file data
        u!Top data was not formed as a dictuincludeu5Environment {0} in top file is not formed as a stringuu#Empty saltenv statement in top fileu@The top file matches for saltenv {0} are not formatted as a dictu;Malformed topfile (state declarations not formed as a list)u>Improperly formatted top file matcher in saltenv {0}: {1} fileu+Environment {0} contains an empty sls index(	R>R?RFRRGRVRRXRH(RR�R�RjtmatchestslsmodstslsmodR�((s./usr/lib/python2.7/site-packages/salt/state.pytverify_tops�sF




cC@sGy|j�}Wn'tk
r9}tjd|j�iSX|j|�S(uA
        Returns the high data derived from the top file
        uUnable to render top file: %s(R�RRNROR�(RR�R�((s./usr/lib/python2.7/site-packages/salt/state.pytget_top$
sc
@s9tt��x�tj|�D]�\�}�jdrQ��jdkrQqqQnxLtj|�D];\}}����fd���||�jd�qaWqW�j�}x�|D]z��j�g�}�jjd�r�|�}|}n|}|�}|g|D]}	|	|kr|	^q��<q�W�S(u�
        Search through the top high data for matches and return the states
        that this minion needs to execute.

        Returns:
        {'saltenv': ['state1', 'state2', ...]}
        usaltenvc	@s?t|tj�r|g}n�jd|||�r;��krPg��<nx�|D]�}d|kr�|jd�}x0tj|�D]\}}�|||�q�Wnt|tj�r���j|�qWt|t�rW|j�\}}|�j	krqWn|�kr g�|<n�|j|�qWqWWndS(Nuconfirm_top.confirm_topu	subfilter(
R>RRVtmatchersRRGRFR?tpopitemR�(	t_matcht_datat_optsRDt_tmpdatatmatchR�tenv_keytinc_sls(t_filter_matchesR�RjR(s./usr/lib/python2.7/site-packages/salt/state.pyR>
s,
	


u
nodegroupsumaster_tops_first(R
R	RRGRvt_master_topsR�(
RR�R�RR�text_matchesttop_file_matchestfirsttsecondR`((RR�RjRs./usr/lib/python2.7/site-packages/salt/state.pyttop_matches/
s$
	

	
1cC@s
|jj�S(u�
        Get results from the master_tops system. Override this function if the
        execution of the master_tops needs customization.
        (R�tmaster_tops(R((s./usr/lib/python2.7/site-packages/salt/state.pyR	e
scC@s�|jdsdS|jjdt|�dt�}|drutjj|j�|jd<|jj�|jjd<n|jj	�dS(ui
        If autoload_dynamic_modules is True then automatically load the
        dynamic modules
        uautoload_dynamic_modulesNusaltutil.sync_alltrefreshugrainsupillar(
RvRR�RHRYRR�RiR�R�(RR�tsyncd((s./usr/lib/python2.7/site-packages/salt/state.pytload_dynamicl
s
	
c
C@sfg}|s6|jj||�}|jdt�}n1|}tjj|�sg|jdj|��nd }	|s�|jdj||��nyLt
||jj|jj
d|jj
d|jj
d||d|�}	Wn�tk
r}
dj|||
�}tj|�|j|�nZtk
rx}
d	j||
�}tj|d
tj�|jdj|tj���nXy|jdj||��Wntk
r�nX|	rVt|	t�s�|jd
j|��q\g}d|	kr.t|	dt�sdj|�}
|j|
�q.|	jd�}n|j|	|||�|j|	|||�|j|	|||�x�|D]�}d}t|t�r�|j�\}}n|}||j kr�dj||||�}tj!|�|j|�qwn|j"d�r
t#j$d|�}|r0|j%�\}}n2dj|||�}tj!|�|j|�qwt&|�}|j'd�}|jdd�j(d�r�|jd�n|t&|�kr�dj|||�}tj!|�|j|�qwndj)|| |g�}n||krh|d kr.g}n||ksSt*j+|j ||�r_|g}q�g}n2g|D]%}t*j+|j ||�ro|^qo}t&|�dks�||kr�t*j+|j ||�p�|g}x=|D]�}t&|�dkr|dn|}dj||�}||kr�|j,||||�\}}
|rn|j-|	||�|	j.|�n|
r�|j/|
�q�q�q�Wqwd}|s�dj||||kr�dj)|�n|�}n3t&|�dkrdj||dj)|��}ntj|�|j|�qwWy|j0|	�Wq\t1k
rRtjd|�q\Xni}	|	|fS(!uL
        Render a state file and retrieve all of the include states
        udestu6Specified SLS {0} on local filesystem cannot be found.ugSpecified SLS {0} in saltenv {1} is not available on the salt master or through a configured fileserverurendererurenderer_blacklisturenderer_whitelisttrendered_slsu#Rendering SLS '{0}:{1}' failed: {2}u+Rendering SLS {0} failed, render error: {1}R0u{0}
{1}u{0}:{1}u'SLS {0} does not render to a dictionaryuincludeu6Include Declaration in SLS {0} is not formed as a listu_xenvuHNonexistent saltenv '{0}' found in include of '{1}' within SLS '{2}:{3}'u.u^(\.+)(.*)$u=Badly formatted include {0} found in include in SLS '{2}:{3}'usourceuu	/init.slsuinituWAttempted relative include of '{0}' within SLS '{1}:{2}' goes beyond top level package iiu_Unknown include: Specified SLS {0}: {1} is not available on the salt master in saltenv(s): {2} u, umAmbiguous include: Specified SLS {0}: {1} is available on the salt master in multiple available saltenvs: {2}u/Could not render SLS %s. Syntax error detected.N(2R�R�R�RYR0R1R|RFRRZRRRwRvRRNtcriticalR�R1R2R3R4RAR�R>R?RHRt_handle_extendt_handle_excludet_handle_state_declsRR�RORPtreRtgroupsR@RR�R2RR�trender_statetmerge_included_statesR�Rt_handle_iorderRM(RRQRjtmodsR�tlocalR�t
state_dataR6RR�R^R�R�Rtxenv_keyRRtlevelstlevel_counttp_compst
resolved_envstaenvtsls_targetst
sls_targettr_envtmod_tgttnstate((s./usr/lib/python2.7/site-packages/salt/state.pyRz
s
	





#
	






	%	
%
		
"'

cC@s[|jdrWxG|D]<}x3||D]'}t|tj�sCq%nt||t�s\q%nt|||t�syq%nt}|jd�r�q%nxa|||D]Q}t|t�r�t|�dkr�t	tj
|��dkr�t}q�q�q�q�W|s%t|||t�sq%n|||ji|j
d6�|j
d7_
q%q%WqWn|S(u:
        Take a state and apply the iorder system
        ustate_auto_orderu_iuorderi(RvR>RRVR?RHRYRPR@R8R�R\RFR�(RRRts_decR RK((s./usr/lib/python2.7/site-packages/salt/state.pyR3s0

c	C@sx|D]
}t||t�s�|dkr2qn|dkrDqnt||tj�r�d||kr�||jd�}i|d6|d6|dg|d6||<qq�n|jdj||��qnt�}x�t||�D]�}|j	d	�rq�nt|||t�s!q�nd|kr�|jd�}|d|krk|jd
j||��q�n||j
|�|||d<|||dj|d�|j|d�q�n|j|�q�Wd||kr�|||d<nd||kr|||d<qqWdS(u=
        Add sls and saltenv components to the state
        u
__extend__u__exclude__u.u__sls__u__env__iiu%ID {0} in SLS {1} is not a dictionaryu_uKID '{0}' in SLS '{1}' contains multiple state declarations of the same typeN(R>R?RRVRRFRR=RHRPRRA(	RRRQRjR�RR�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyRXsL

		
c	C@s�d|kr�|jd�}t|t�sD|jdj|��dSx)|D]!}t||t�s�|jdj||��qKnd||kr�|||d<nd||kr�|||d<nx�t||�D]�}|jd�r�q�nt|||t�sq�nd|kr�|jd�}||j|�|||d	<|||d	j|d
�q�q�WqKW|jdg�j|�ndS(u`
        Take the extend dec out of state and apply to the highstate global
        dec
        uextendu0Extension value in SLS '{0}' is not a dictionaryNu5Extension name '{0}' in SLS '{1}' is not a dictionaryu__sls__u__env__u_u.iiu
__extend__(	RR>R?RFRRHRPRRQ(	RRRQRjR�RRR�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�s2


(cC@sid|kre|jd�}t|t�sIdj|�}|j|�n|jdg�j|�ndS(uh
        Take the exclude dec out of the state and apply it to the highstate
        global dec
        uexcludeu6Exclude Declaration in SLS {0} is not formed as a listu__exclude__N(RR>RHRRFRQR(RRRQRjR�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�s	cC@s�|j}g}t�}g}x�tj|�D]x\}}xi|D]a}||jkrrtj|j||�}nAd|jkr�tj|jd|�}n|jdj|��|s�|g}nx�|D]�}	dj||	�}
|
|kr�q�n|j	|	|||�\}}|r0|j
|||�nx^t|�D]O\}
}d|kr>dj|�}||kr�dj||�||
<q�q>q>W|j|�q�WqAWq.W|j
|�||fS(up
        Gather the state files and render them into a single unified salt
        high data structure.
        u__env__u8No matching salt environment for environment '{0}' foundu{0}:{1}uis not availableuSLS {0} in saltenvu,No matching sls found for '{0}' in env '{1}'(R�R=RRGR�RR�RFRRRRcRtclean_duplicate_extends(RR�t	highstatet
all_errorsRt
statefilesRjR�R�RQR(RR�R�ROtthis_sls((s./usr/lib/python2.7/site-packages/salt/state.pytrender_highstate�sB		


	
cC@s�d|kr�g}xId�|dD�D]3}x*|D]"}||kr4|j|�q4q4Wq'Wg|D]}i|d|d6^qe|d<ndS(Nu
__extend__cs@s|]}tj|�VqdS(N(RRG(RR((s./usr/lib/python2.7/site-packages/salt/state.pys	<genexpr>�sii(RF(RR-thighextRRDtt((s./usr/lib/python2.7/site-packages/salt/state.pyR,�s
c	C@sd|kr1|jdg�j|jd��nd|krb|jdg�j|jd��nxv|D]n}||kri||||kr�|jdj|||d||d||d||d��q�qiqiWy|j|�Wn'tk
r|jdj|��nXdS(Nu
__extend__u__exclude__u�Detected conflicting IDs, SLS IDs need to be globally unique.
    The conflicting ID is '{0}' and is found in SLS '{1}:{2}' and SLS '{3}:{4}'u__env__u__sls__u-Error when rendering state with contents: {0}(RQRRRFRR�t
ValueError(RR-RR�R((s./usr/lib/python2.7/site-packages/salt/state.pyR�s*		

cC@s(|r
tSd|jjdkr$tStS(u�
        Check the pillar for errors, refuse to run the state if there are
        errors in the pillar and return the pillar errors
        u_errorsupillar(R\RRvRY(Rtforce((s./usr/lib/python2.7/site-packages/salt/state.pyt
_check_pillars
cC@s�|s
|Si}t|t�s1|jd�}nxc|D][}xR||D]F}||krI||krq||ng||<||j|�qIqIWq8W|S(ux
        Reads over the matches and returns a matches dict with just the ones
        that are in the whitelist
        u,(R>RHRRF(RR�t	whitelisttret_matchesR�RQ((s./usr/lib/python2.7/site-packages/salt/state.pytmatches_whitelist s
 u	highstatecC@sKd}iitd6dd6dd6id6dd	6|6}tjj|jd
dj|��}	|r�tjj|	�r�tjj	j
|	d��,}
|jj|
�}|j
j||�SWd
QXq�ng}y|j�}
Wnltk
r}d||d<||dctj|j�7<|Stk
rCtj�}|j|�|SX||j|
�7}|j|
�}|s�d}|||d<|S|j||�}|j|�|j|�s�|dg7}||j
jdd7}nv|j|�\}}|rFt|tj�r|j d�}nd|kr9|dj!|�qF||d<n||7}|rZ|S|sd|Stjj	j"d���y�tjj#j$�r�|j
j%ddd|	gdtdd�ntjj	j
|	d��2}
y|jj&||
�Wnt'k
rnXWd
QXWn't(t)fk
r1t*jd|	�nXWd
QX|j
j||�S(uP
        Run the sequence to execute the salt highstate for this minion
        uno_|-states_|-states_|-NoneuresultuNo states found for this minionucommentu	No Statesunameuchangesiu__run_num__ucachediru{0}.cache.purbNuUnable to render top file: uQNo Top file or master_tops data matches found. Please see master log for details.u4Pillar failed to render with the following messages:upillaru_errorsu,u__exclude__i?ucmd.runuattribu-RR�toutput_logleveluquietuw+bu2Unable to write to "state.highstate" cache file %s(+RYR0R1R2RvRR|RRRR8R�R�RR�R�RRR[ROR�R3R4RFR�RR9RR6R1R>RVRRt	set_umasktplatformt
is_windowsR�tdumpRMR�R7RN(RR�tcachet
cache_nameR5R7Rttag_nameRRtcfnR>RBR�R�R;R�R^R�((s./usr/lib/python2.7/site-packages/salt/state.pytcall_highstate1s�	
 








cC@sag}|j�}||j|�7}|j|�}|j|�\}}||7}|r]|S|S(u9
        Return just the highstate or the errors
        (R�R�RR1(RR�R�R�RBR�((s./usr/lib/python2.7/site-packages/salt/state.pyRf�s
cC@s�|j�}|j|�}|j|�\}}|jj|�\}}||7}||jj|�7}|jj|�\}}||7}|jj|�}|r�|S|jj|�}|S(u�
        Compile the highstate but don't run it, return the low chunks to
        see exactly what the highstate will execute
        (	R�RR1RRR�R/R�R�(RR�R�RBR�R�R.R�((s./usr/lib/python2.7/site-packages/salt/state.pytcompile_low_chunks�s

c
C@sg}|j�}||j|�7}|r/|S|j|�}i}x�|jj�D]�\}}igd6gd6dd6dd6dd6}|j|�}xo|D]g}	|dcd7<|	|kr�|dcd7<|dj|	�q�|dcd7<|dj|	�q�W|||<qTW|S(u^
        Return all used and unused states for the minion based on the top match data
        uuseduunusediu	count_allu
count_useducount_unusedi(R�R�RR�RR�RF(
RR�R�R�tstate_usageRjR�t	env_usagetenv_matchesR((s./usr/lib/python2.7/site-packages/salt/state.pytcompile_state_usage�s0

N(!RrRsRtRyR�R�R�R�R�R�R�R�R�R�RR	RRYRRRRRR1R,RR6R9RZRCRfRDRH(((s./usr/lib/python2.7/site-packages/salt/state.pyR�ns<				/		z		3	?	&	3		6		�	%	9	 	
	1					P		t	HighStatec	B@skeZdZgZdddddeddd�Zd�Zed��Z	ed��Z
ed��ZRS(u�
    Generate and execute the salt "High State". The High State is the
    compound state derived from a group of template files stored on the
    salt master or in the local cache.
    ustatesc

C@s�||_tjj|j�|_tj||�t|j|||d|d|d|d|d|	�|_tj	j
|j�|_
||_i|_g|_
dS(NR�R�R�R�R�(RvRt
fileclienttget_file_clientR�R�RyR�RR�R�R�t_pydsl_all_declst_pydsl_render_stack(
RRvR�R�R�R�R�R�R�R�((s./usr/lib/python2.7/site-packages/salt/state.pyRy�s 				cC@s|jj|�dS(N(tstackRF(R((s./usr/lib/python2.7/site-packages/salt/state.pytpush_active�scC@s
g|_dS(N(RN(tcls((s./usr/lib/python2.7/site-packages/salt/state.pytclear_activescC@s|jj�dS(N(RNR(RP((s./usr/lib/python2.7/site-packages/salt/state.pyt
pop_active	scC@s(y|jdSWntk
r#dSXdS(Ni����(RNt
IndexErrorRZ(RP((s./usr/lib/python2.7/site-packages/salt/state.pyt
get_active
s
N(RrRsRtRNRZRYRyROtclassmethodRQRRRT(((s./usr/lib/python2.7/site-packages/salt/state.pyRI�s		tMasterStatecB@s&eZdZd�Zddd�ZRS(u9
    Create a State object for master side compiling
    cC@stj||�dS(N(R�Ry(RRvtminion((s./usr/lib/python2.7/site-packages/salt/state.pyRyscC@s�tjd�tjj|j|jd�|_tjj|j�|_tjj	|j�|_	tjj
|j|j|j|j	�|_
tjj|j|jd|j
�|_dS(u1
        Load the modules into the state
        u(Loading fresh modules for state activityuidR�N(
RNR]RR�tFunctionWrapperRvR�R�RR�R�R�Rw(RR�R�((s./usr/lib/python2.7/site-packages/salt/state.pyR�s
	*N(RrRsRtRyRZR�(((s./usr/lib/python2.7/site-packages/salt/state.pyRVs	RecB@seZdZdd�ZRS(u7
    Execute highstate compilation from the master
    cC@sktj|�}d|d<|d|d<|d|d<|d|d<||d<||d<tj||�dS(	Nulocalufile_clientumaster_rootsu
file_rootsurendereru	state_topuidugrains(R�R�RIRy(RRgRhRiRRjRv((s./usr/lib/python2.7/site-packages/salt/state.pyRy4s


N(RrRsRtRZRy(((s./usr/lib/python2.7/site-packages/salt/state.pyRe0stRemoteHighStatecB@s2eZdZd�Zd�Zd�Zd�ZRS(u3
    Manage gathering the data from the master
    cC@sY||_||_tjj|j�|_tjjjj	|jd�|_
t|_dS(Nu
master_uri(
RvRiRR�R�R�t	transportR�t
ReqChanneltfactorytchannelRYt_closing(RRvRi((s./usr/lib/python2.7/site-packages/salt/state.pyRyFs
		"cC@sZi|jd6|jd6dd6}y |jj|dddd�SWntk
rUiSXd	S(
u7
        Return the state data from the master
        ugrainsuoptsu
_master_stateucmdR�ittimeouti@N(RiRvR]tsendR(RR�((s./usr/lib/python2.7/site-packages/salt/state.pytcompile_masterNs


 
cC@s'|jr
dSt|_|jj�dS(N(R^R\R]tclose(R((s./usr/lib/python2.7/site-packages/salt/state.pytdestroyZs		cC@s|j�dS(N(Rc(R((s./usr/lib/python2.7/site-packages/salt/state.pyt__del__as(RrRsRtRyRaRcRd(((s./usr/lib/python2.7/site-packages/salt/state.pyRYAs
			(`Rtt
__future__RRRR0RMR�R�RR1R"R3RR%RStsalt.loaderRtsalt.miniontsalt.pillartsalt.fileclienttsalt.utils.argstsalt.utils.crypttsalt.utils.datatsalt.utils.decorators.statetsalt.utils.dictupdatetsalt.utils.eventtsalt.utils.filestsalt.utils.hashutilstsalt.utils.immutabletypesRRKtsalt.utils.platformtsalt.utils.processtsalt.utils.urlt
salt.syspathsR�tsalt.transport.clienttsalt.serializers.msgpackRR:RR}t
salt.templateRRtsalt.exceptionsRRtsalt.utils.odictR	R
tsalt.utils.yamlloaderR�Rtsalt.extRtsalt.ext.six.movesRR
Rt	getLoggerRrRNt	frozensetRtSTATE_REQUISITE_IN_KEYWORDStSTATE_RUNTIME_KEYWORDSRRJRt__hash__RRR R!R/R7R<RERLRURdRkRnRpR�RqtobjectRuR�R�RIRVReRY(((s./usr/lib/python2.7/site-packages/salt/state.pyt<module>
s									
				,			�V�������������jA

Zerion Mini Shell 1.0