%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlmZddl	m
Z
ddlmZd*Z
eje�Zdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZd!efd"��YZd#efd$��YZd%eje
e�fd&��YZd'�Zd(ejee�fd)��YZ dS(+u�
:maintainer: Evan Borgstrom <evan@borgstrom.ca>

Pythonic object interface to creating state data, see the pyobjects renderer
for more documentation.
i(tabsolute_importtprint_functiontunicode_literalsN(tOrderedDict(tPrepareable(tsixulistenu	onchangesuonfailurequireuwatchuuseu	listen_inuonchanges_inu	onfail_inu
require_inuwatch_inuuse_intStateExceptioncB@seZRS((t__name__t
__module__(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRstDuplicateStatecB@seZRS((RR(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR	stInvalidFunctioncB@seZRS((RR(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR
stRegistrycB@s�eZdZe�ZgZgZe�ZeZ	e
d��Ze
d��Ze
d��Z
e
ed��Ze
d��Ze
d��Ze
d��Ze
d��ZRS(	uK
    The StateRegistry holds all of the states that have been created.
    cC@s.t�|_g|_g|_t�|_dS(N(Rtstatest
requisitestincludestextends(tcls((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytempty+s		cG@s |js
dS|j|7_dS(N(tenabledR(Rtargs((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytinclude2s	cC@s�tgtj|j�D]\}}||f^q�}|jrP|j|d<n|jr�tgtj|j�D]\}}||f^qo�|d<n|j�|S(Nuincludeuextend(RRt	iteritemsRRRR(Rtid_tstates_R((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt	salt_data9s1		8
cC@s�|js
dS|r|j}n	|j}||krh|j||krutdj||j���qun
t�||<t|j�dkr�xS|jD]E}|j	|j
kr�g|j
|j	<n|j
|j	j|��q�Wn||j|��dS(Nu,A state with id ''{0}'', type ''{1}'' existsi(
RRRt	full_funcR	tformatRtlenR
t	requisitetkwargstappendtupdate(RRtstatetextendtattrtreq((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytaddMs$		
!cC@s|j||dt�dS(NR!(R$tTrue(RRR ((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR!kscC@s
t|�S(N(tStateExtend(Rtname((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytmake_extendoscC@s!|js
dS|jj|�dS(N(RR
R(RR((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytpush_requisitess	cC@s|js
dS|jd=dS(Ni����(RR
(R((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt
pop_requisitezs	(RRt__doc__RRR
RRR%RtclassmethodRRRtFalseR$R!R(R)R*(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR!s		R&cB@seZd�ZRS(cC@s
||_dS(N(R'(tselfR'((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__init__�s(RRR/(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR&�stStateRequisitecB@s,eZd�Zd�Zd�Zd�ZRS(cC@s||_||_||_dS(N(RtmoduleR(R.RR1R((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR/�s		cC@si|j|j6S(N(RR1(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__call__�scC@stj|�dS(N(RR)(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt	__enter__�scC@stj�dS(N(RR*(R.ttypetvaluet	traceback((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__exit__�s(RRR/R2R3R7(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR0�s			tStateFactorycB@s/eZdZdd�Zd�Zdd�ZRS(u�
    The StateFactory is used to generate new States through a natural syntax

    It is used by initializing it with the name of the salt module::

        File = StateFactory("file")

    Any attribute accessed on the instance returned by StateFactory is a lambda
    that is a short cut for generating State objects::

        File.managed('/path/', owner='root', group='root')

    The kwargs are passed through to the State object
    cC@s+||_|dkrg}n||_dS(N(R1tNonetvalid_funcs(R.R1R:((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR/�s		c@sXt�j�dkrB��jkrBtdj��j���n��fd�}|S(Niu?The function '{0}' does not exist in the StateFactory for '{1}'c@st|�j�|�S(N(tStateR1(RR(tfuncR.(s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt
make_state�s
(RR:R
RR1(R.R<R=((R<R.s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__getattr__�s$	urequirecC@st||j|�S(uJ
        When an object is called it is being used as a requisite
        (R0R1(R.RR((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR2�sN(RRR+R9R/R>R2(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR8�s	R;cB@sYeZdZd�Zed��Zed��Zd�Zd�Zd�Z	d�Z
RS(u�
    This represents a single item in the state tree

    The id_ is the id of the state, the func is the full name of the salt
    state (i.e. file.managed). All the keyword args you pass in become the
    properties of your state.
    cK@s�||_||_||_xTtD]L}||kr"yt||�Wqntk
rj||g||<qnXq"q"W||_t|jt�r�t	j
|jj|�|jj|_nt	j|j|�t
d|j|j�|_dS(Nurequire(RR1R<t
REQUISITEStitert	TypeErrorRt
isinstanceR&RR!R'R$R0R(R.RR1R<RR"((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR/�s			

	cC@s�|j}xVtD]N}||krg||D]$}t|t�rK|�n|^q-||<qqWgttj|��D]}i|||6^qxS(N(RR?RBR0tsortedRtiterkeys(R.RR"R#tk((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pytattrs�s	
=cC@sdj|j|j�S(Nu{0!s}.{1!s}(RR1R<(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR�scC@sdj|j|j|j�S(Nu{0!s} = {1!s}:{2!s}(RRRRF(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__str__�scC@si|j|j6S(N(RFR(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR2scC@stj|j�dS(N(RR)R(R.((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR3scC@stj�dS(N(RR*(R.R4R5R6((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR7
s(RRR+R/tpropertyRFRRGR2R3R7(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR;�s				t
SaltObjectcB@s eZdZd�Zd�ZRS(u�
    Object based interface to the functions in __salt__

    .. code-block:: python
       :linenos:
        Salt = SaltObject(__salt__)
        Salt.cmd.run(bar)
    cC@s
||_dS(N(t_salt(R.tsalt((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR/sc@s&dtf��fd��Y}|�S(Nt__wrapper__c@seZ��fd�ZRS(c@s9y�jdj�|�SWntk
r4t�nXdS(Nu{0}.{1}(RJRtKeyErrortAttributeError(twselfR<(tmodR.(s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR>s
(RRR>((RPR.(s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRLs(tobject(R.RPRL((RPR.s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR>s(RRR+R/R>(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRIs	tMapMetacB@s8eZdZed��Zd�Zd�Zd�ZRS(uk
    This is the metaclass for our Map class, used for building data maps based
    off of grain data.
    cC@st�S(N(R(tmetaclsR'tbases((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt__prepare__)scC@s+tj||||�}|j�|_|S(N(R4t__new__tkeyst__ordered_attrs__(RR'RTRFtc((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRV-scC@s*|j�tt|�j|||�dS(N(t__set_attributes__tsuperRRR/(RR'RTtnmspc((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyR/2s
cC@s�g}t�}x�|jD]�}|ddkr5qn|j|}tj|�sWqnt|dd�}|j|�t|d|�}i}x5|jD]*}|ddkr�|j|||<q�q�W|j|||f�qWy�t|j	d�st
jd�n�g}	xv|j	D]k}xbtt
|��D]N\}
}y.|d|krg|	j|�d||
<nWq.tk
r{q.Xq.WqW|	jg|D]}|dk	r�|^q��|	}Wntk
r�nXi}|r9tjd|�}
xL|D]A\}}}||
krq�n|
||kr�|j|�q�q�Wnt|d	�rwtjd
|j�}|rw|j|�qwnx"|D]}t||||�q~WdS(Niu_u	__grain__u	os_familyu	__match__u__iter__u'pyobjects: priority must be an iterableugrains.itemumergeu
pillar.get(tsetRXt__dict__tinspecttisclasstgetattrR$Rthasattrtprioritytlogterrortlistt	enumerateR9RAR!RNtMapt__salt__Rtmergetsetattr(Rt
match_infot
grain_targetstitemtfilttgraintmatchtmatch_attrsR'tnew_match_infotindextxRFt
grain_valstpillar((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRZ6s\	



,


(RRR+R,RURVR/RZ(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRR$s
		cO@stjd�iS(Nu-Map needs __salt__ set before it can be used!(RdRe(taRE((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt	need_salt�s
RhcB@seZied6ed6ZRS(ugrains.filter_byu
pillar.get(RRRyRi(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyRh�s(ulistenu	onchangesuonfailurequireuwatchuuseu	listen_inuonchanges_inu	onfail_inu
require_inuwatch_inuuse_in(!R+t
__future__RRRR_tloggingtsalt.utils.odictRtsalt.utils.schemaRtsalt.extRR?t	getLoggerRRdt	ExceptionRR	R
RQRR&R0R8R;RItwith_metaclassR4RRRyRh(((s8/usr/lib/python2.7/site-packages/salt/utils/pyobjects.pyt<module>s(a.I"_	

Zerion Mini Shell 1.0