%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/loader.pyc

�
���^c	@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'dd	l(m)Z)ej*d
 ddfkr�ddl+Z,ddl-Z,e.Z/nddl0Z0e1Z/ydd
l2m3Z3Wn!e4k
r%dd
l5m3Z3nXyddl6Z6e.Z7Wne4k
rUe1Z7nXe	j8e9�Z:ej;j<ej=j>�Z?dZ@e/r^dZAd
ZBdZCdZDgZEx*e,jFjGD]ZHeEjIeHdeCf�q�Wx*e,jFjJD]ZHeEjIeHdeAf�q�Wx*e,jFjKD]ZHeEjIeHdeBf�qWie,jFjLeA6e,jFjMeB6e,jFjNeC6ZOne0jP�ZEejQdjRej*d
 ��ZSdddfZTeUaVeUeUe.eUeUeUd�ZWd�ZXeUeUe.eUeUd�ZYeUeUeUe1eUe1eUeUd�ZZdd�Z[d�Z\d�Z]eUd�Z^eUeUeUeUd�Z_eUeUeUd�Z`eUeUe_d �ZaeUd!�Zbd"�ZceUeUd#�Zdd$�Zed%�Zfd&�ZgeUd'�Zhd(�ZieUeUeUd)�Zjd*�ZkeUeUd+�ZleUeUd,�Zmd-�ZneUeUd.�ZoeUeUd/�ZpeUd0�Zqd1�Zre1eUd2�Zsd3�ZteUeUeUd4�Zud5�ZveUeUeUd6�Zwd7�Zxd8�Zyd9�Zzd:�Z{eUeUeUd;�Z|d<�Z}d=�Z~d>�Zd?e3fd@��YZ�dAejaj�j�fdB��YZ�dC�Z�dS(Du�
The Salt loader is the core to Salt's plugin system, the loader scans
directories for python loadable code and organizes the code into the
plugin interfaces used by Salt.
i(tabsolute_importtprint_functiontunicode_literalsN(tzipimporter(tLoaderError(tcheck_render_pipe_str(tDepends(tsix(t
reload_moduleiii(tMutableMappingusalt.loadediurbu\.cpython-{0}{1}(\.opt-[1-9])?uparallels.avail_sizesuparallels.avail_locationsuproxmox.avail_sizesc		C@s~tt|||||||�|d|d|�}	i}
|	j�|r[t|	|�}	nx|	D]}|	||
|<qbW|
S(Nttagtpack(t
LazyLoadert_module_dirst	_load_alltFilterDictWrapper(toptstext_typeR
Rtint_typetext_dirst
ext_type_dirst	base_pathtfilter_nametfuncstrettkey((s//usr/lib/python2.7/site-packages/salt/loader.pyt
static_loaderms&	

cC@s3|j}|jr/|ddj|j�7}n|S(us
    Makes a string describing the target of an EntryPoint object.

    Base strongly on EntryPoint.__str__().
    u:u.(tmodule_nametattrstjoin(tepts((s//usr/lib/python2.7/site-packages/salt/loader.pyt_format_entrypoint_target�s		c	C@s�|dkr|}ntjj|p't|p0|�}tjj|d|�}g}	|r;|dkrydj|�}n||kr�|	j||�ntr;|r;x�tj	d|�D]y}
y1|
j
�}x|�D]}|	j|�q�WWq�tk
r0}
t
jdt|
�|
�t
jddt�q�Xq�Wq;ng}x�|jdg�D]�}tjj||�}tjj|�r�|jd|�qTntjj|d	j|��}tjj|�rT|jd|�qTqTW||	||gS(
Nuextension_modulesu{0}_dirsusalt.loaderu,Error getting module directories from %s: %su+Full backtrace for module directories errortexc_infoumodule_dirsiu_{0}(tNonetostpathRtSALT_BASE_PATHtformattextendtHAS_PKG_RESOURCESt
pkg_resourcestiter_entry_pointstloadtappendt	ExceptiontlogterrorR tdebugtTruetgettisdirtinsert(RRR
RRRRt	sys_typest	ext_typestext_type_typestentry_pointtloaded_entry_pointR$texctcli_module_dirst_dirt	maybe_dir((s//usr/lib/python2.7/site-packages/salt/loader.pyR
�s:		!!c	
C@so|s|jdd�}ntt|dd�|dddi|d6|d6|d6d	|d
|d|�}	|	|	jd<|jd
t�}
|
r't|
t�r'x�|
D]|}yt||
||	�}Wnt	k
r�Pq�X|r�x>|D]3}
dj
||
|
jd��}||
|	|<q�Wq�q�Wn|rktj
jjdd|dt�}|jitd6dd�n|	S(uI
    Load execution modules

    Returns a dictionary of execution modules appropriate for the current
    system by evaluating the __virtual__() function in each module.

    :param dict opts: The Salt options dictionary

    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__

    :param dict utils: Utility functions which should be made available to
                            Salt modules in __utils__. See `utils_dirs` in
                            salt.config for additional information about
                            configuration.

    :param list whitelist: A list of modules which should be whitelisted.
    :param bool initial_load: Deprecated flag! Unused.
    :param str loaded_base_name: A string marker for the loaded base name.
    :param bool notify: Flag indicating that an event should be fired upon
                        completion of module loading.

    .. code-block:: python

        import salt.config
        import salt.loader

        __opts__ = salt.config.minion_config('/etc/salt/minion')
        __grains__ = salt.loader.grains(__opts__)
        __opts__['grains'] = __grains__
        __utils__ = salt.loader.utils(__opts__)
        __salt__ = salt.loader.minion_mods(__opts__, utils=__utils__)
        __salt__['test.ping']()
    uwhitelist_modulesumodulesumoduleR
Ru__context__u	__utils__u	__proxy__t	whitelisttloaded_base_nametstatic_modulesu__salt__u	providersu{0}{1}u.uminionRtlistenucompleteu /salt/minion/minion_mod_completeN(R2R"RR
RtFalset
isinstancetdicttraw_modt	TypeErrorR&trindextsalttutilsteventt	get_eventt
fire_eventR1(RtcontextRIR>tinitial_loadR?tnotifyR@tproxyRt	providerstmodRtfunctf_keytevt((s//usr/lib/python2.7/site-packages/salt/loader.pytminion_mods�s4-	



!umodulescC@satt||d�|dddtdi|d6�}||jkrGiS|j|�t|j�S(uE
    Returns a single module loaded raw and bypassing the __virtual__ function

    .. code-block:: python

        import salt.config
        import salt.loader

        __opts__ = salt.config.minion_config('/etc/salt/minion')
        testmod = salt.loader.raw_mod(__opts__, 'test', None)
        testmod['test.ping']()
    umoduleR
u	rawmoduletvirtual_enableRu__salt__(RR
RBtfile_mappingt_load_moduleRDt_dict(Rtnamet	functionsRRtloader((s//usr/lib/python2.7/site-packages/salt/loader.pyREs

cC@stt|d�|dd�S(u1
    Return functions used in the meta proxy
    u	metaproxyR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pyt	metaproxy9scC@stt|d�|dd�S(u-
    Return the matcher services plugins
    umatchersR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pytmatchersEscC@sDi|d6|d6|d6|d6}tt|d�|ddd|�S(u,
    Return the master services plugins
    u__salt__u__runners__u	__proxy__u	__utils__uenginesR
R(RR
(RR\trunnersRIRPR((s//usr/lib/python2.7/site-packages/salt/loader.pytenginesPs

c	C@sJtt|d�|dddi|d6|d6|d6�}||jd<|S(u=
    Returns the proxy module for this salt-proxy-minion
    uproxyR
Ru__salt__u__ret__u	__utils__u	__proxy__(RR
R(RR\t	returnersR>RIR((s//usr/lib/python2.7/site-packages/salt/loader.pyRP`s
cC@sFtt|dd�|ddd|di|d6|d6|p>id6�S(	u&
    Returns the returner modules
    u	returnersureturnerR
R>Ru__salt__u__context__u	__proxy__(RR
(RR\R>RMRP((s//usr/lib/python2.7/site-packages/salt/loader.pyRbpscC@sBtt|ddd�|ddd|di|d6|p:id6�S(	u%
    Returns the utility modules
    uutilsRu
utils_dirsR
R>Ru__context__u	__proxy__(RR
(RR>RMRP((s//usr/lib/python2.7/site-packages/salt/loader.pyRI}sc	C@sYtt|d�|dddi|d6|d6t|�d6�}||jd<t|d�S(	u%
    Returns the pillars modules
    upillarR
Ru__salt__u__context__u	__utils__u__ext_pillar__u.ext_pillar(RR
RIRR(RR\RMR((s//usr/lib/python2.7/site-packages/salt/loader.pytpillars�s

cC@sZd|kriSt|dj��}tt|dd�|ddd|�}t|d�S(u"
    Returns the tops modules
    umaster_topsutopsutopR
R>u.top(tlisttkeysRR
R(RR>R((s//usr/lib/python2.7/site-packages/salt/loader.pyttops�s	cC@sD|dkri}ntt|d�|ddd|di|d6�S(u$
    Returns the wheels modules
    uwheelR
R>Ru__context__N(R"RR
(RR>RM((s//usr/lib/python2.7/site-packages/salt/loader.pytwheels�s	cC@sDtt|ddd�|dd�}t|d�}||jd<|S(u�
    Returns the outputters modules

    :param dict opts: The Salt options dictionary
    :returns: LazyLoader instance, with only outputters present in the keyspace
    uoutputRuoutputter_dirsR
u.outputu__salt__(RR
RR(RRtwrapped_ret((s//usr/lib/python2.7/site-packages/salt/loader.pyt
outputters�s	
cC@stt|d�|dd�S(u�
    Returns the serializers modules
    :param dict opts: The Salt options dictionary
    :returns: LazyLoader instance, with only serializers present in the keyspace
    userializersR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pytserializers�scC@stt|d�|dd�S(u�
    Returns the tokens modules
    :param dict opts: The Salt options dictionary
    :returns: LazyLoader instance, with only token backends present in the keyspace
    utokensR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pyteauth_tokens�scC@s5tt|d�|ddd|dit|�d6�S(un
    Returns the auth modules

    :param dict opts: The Salt options dictionary
    :returns: LazyLoader
    uauthR
R>Ru__salt__(RR
RV(RR>((s//usr/lib/python2.7/site-packages/salt/loader.pytauth�scC@s5tt|d�|ddd|dit|�d6�S(u)
    Returns the file server modules
    u
fileserverR
R>Ru	__utils__(RR
RI(Rtbackends((s//usr/lib/python2.7/site-packages/salt/loader.pyt
fileserver�s
cC@s6tt|d�|ddd|di|d6|d6�S(u$
    Returns the roster modules
    urosterR
R>Ru
__runner__u	__utils__(RR
(RtrunnerRIR>((s//usr/lib/python2.7/site-packages/salt/loader.pytroster�scC@sPi|d6|d6id6}tt|d�|ddd|�}||jd<|S(u*
    Load the thorium runtime modules
    u__salt__u
__runner__u__context__uthoriumR
Ru__thorium__(RR
R(RR\R`RR((s//usr/lib/python2.7/site-packages/salt/loader.pytthoriums	
c
C@sitt|d�|dddi|d6|p.id6d|�}||jd<||jd<||jd	<|S(
u�
    Returns the state modules

    :param dict opts: The Salt options dictionary
    :param dict functions: A dictionary of minion modules, with module names as
                            keys and funcs as values.

    .. code-block:: python

        import salt.config
        import salt.loader

        __opts__ = salt.config.minion_config('/etc/salt/minion')
        statemods = salt.loader.states(__opts__, None, None)
    ustatesR
Ru__salt__u	__proxy__R>u
__states__u	__utils__u__serializers__(RR
R(RR\RIRjR>RPR((s//usr/lib/python2.7/site-packages/salt/loader.pytstatess	


c
C@sCtt|d�|dddi|d6|d6|p5id6dg�S(u�
    Load the beacon modules

    :param dict opts: The Salt options dictionary
    :param dict functions: A dictionary of minion modules, with module names as
                            keys and funcs as values.
    ubeaconsR
Ru__context__u__salt__u	__proxy__t
virtual_funcs(RR
(RR\RMRP((s//usr/lib/python2.7/site-packages/salt/loader.pytbeacons8s!c
C@sFtt|ddddtjjtd��|dd�}t|d�S(ug
    Returns the custom logging handler modules

    :param dict opts: The Salt options dictionary
    ulog_handlersRuhandlersRulogR
u.setup_handlers(RR
R#R$RR%R(RR((s//usr/lib/python2.7/site-packages/salt/loader.pytlog_handlersIs	c
C@sztt|ddtjjttjjdd���|dddi|d6|jdi�d	6|jd
i�d6|d6�S(
u4
    Returns the custom logging handler modules
    uwrapperRuclientusshR
Ru__salt__ugrainsu
__grains__upillaru
__pillar__u__context__(RR
R#R$RR%R2(RR\RM((s//usr/lib/python2.7/site-packages/salt/loader.pytssh_wrapper\s$cC@s�i|d6|jdi�d6}|r3||d<n|p<i|d<tt|dddd	�|d
dd|�}t|d�}t|d
||d|d�s�dj|d
�}tj|�t|��n|S(u$
    Returns the render modules
    u__salt__ugrainsu
__grains__u
__states__u	__proxy__u	renderersurenderRurender_dirsR
Ru.renderurendererurenderer_blacklisturenderer_whitelistu_The renderer {0} is unavailable, this error is often because the needed software is unavailable(	R2RR
RRR&R.tcriticalR(RR\RrRPRRtrendterr((s//usr/lib/python2.7/site-packages/salt/loader.pytrenderqs*

	!

cC@s%tt|dddd�|dd�S(u�
    Returns the grain functions

      .. code-block:: python

          import salt.config
          import salt.loader

          __opts__ = salt.config.minion_config('/etc/salt/minion')
          grainfuncs = salt.loader.grain_funcs(__opts__)
    ugrainsugrainRugrains_dirsR
(RR
(RRP((s//usr/lib/python2.7/site-packages/salt/loader.pytgrain_funcs�scC@sEtjj|�s#tjd�d
Sttj�tjj|��}||j	dd�kr�tjd||j	dd��d
S|j	dt
�r�tjd�d
Stjd�yvtjj
|�}tjjj|d��+}tjjj|j|�d	t�}Wd
QX|s!tjd�d
S|SWnttfk
r@d
SXd
S(u`
    Returns the grains cached in cfn, or None if the cache is too old or is
    corrupted.
    u!Grains cache file does not exist.ugrains_cache_expirationi,unGrains cache last modified %s seconds ago and cache expiration is set to %s. Grains cache expired. Refreshing.urefresh_grains_cacheu+refresh_grains_cache requested, Refreshing.uRetrieving grains from cacheurbtpreserve_tuplesNu>Cached grains are empty, cache might be corrupted. Refreshing.(R#R$tisfileR.R0R"tintttimetgetmtimeR2RBRHtpayloadtSerialRItfilestfopentdatatdecodeR+R1tIOErrortOSError(Rtcfntgrains_cache_agetserialtfp_t
cached_grains((s//usr/lib/python2.7/site-packages/salt/loader.pyt_load_cached_grains�s.
"

*
cC@s�ddl}tjj|dd�}|rZ|jdt�rZt||�}|rg|Sn
tjd�|jdt�r}iS|jdt�t	k}d	|krri}|j
|jj|d	d
|jj
d	��|jd|d�}|jdg�}	|j
|jj||d	d
t��|j
|jj|	|d	d
t	��d|kre|d|d<q|i|d<n
i|d<i}
t|d|�}|r�|j�nx�|D]y}|jd�s�q�ntjd|�||�}
t|
t�s�q�n|r|jjj
|
|
�q�|
j
|
�q�Wx>|D]6}|jd�s2|dkrYq2nyxtjd|�|jjj||�j}i}d|kr�||d<nd|kr�|
|d<n|||�}
WnStk
r&|jjj�rtjd�ntjd|||dt	�q2nXt|
t�s<q2n|r[|jjj
|
|
�q2|
j
|
�q2W|jdt	�r`|r`y�|jdd}|d|krH|d|krH||d�rHyR|jdd}||d�}
|r
|jjj
|
|
�n
|
j
|
�WqEtk
rAtjddt	�qEXqHnWq`tk
r\q`Xn|
j
|d�|jdt�r�|jj j!d��y�|jjj"�r�ddl#}|j$j%j&dj'|��n|jj j(|d��V}y&|j)j*|�}|j+|
|�Wn&t,k
rB}tj-d|��nXWdQXWnHtk
r�}tj-d ||�tjj.|�r�tj/|�q�nXWdQXn|r�|jjj
|
|d�n|
j
|d�|jj0j1|
d!t	�S("ug
    Return the functions for the dynamic grains and the values for the static
    grains.

    Since grains are computed early in the startup process, grains functions
    do not have __salt__ or __proxy__ available.  At proxy-minion startup,
    this function is called with the proxymodule LazyLoader object so grains
    functions can communicate with their controlled device.

    .. code-block:: python

        import salt.config
        import salt.loader

        __opts__ = salt.config.minion_config('/etc/salt/minion')
        __grains__ = salt.loader.grains(__opts__)
        print __grains__['id']
    iNucachedirugrains.cache.pugrains_cacheu,Grains refresh requested. Refreshing grains.uskip_grainsugrains_deep_mergeu	conf_fileuSALT_MINION_CONFIGudefault_includeuincludetverboseugrainsRPucore.uLoading %s grainu_errorsuproxyudThe following CRITICAL message may not be an error; the proxy may not be completely established yet.uFFailed to load grains defined in grain file %s in function %s, error:
R!uproxy_merge_grains_in_moduleu	proxytypeu.grainsu.initializedu&Failed to run proxy's grains function!i?uattrib -R "{0}"uw+bu$Failed to serialize grains cache: %su+Unable to write to grains cache file %s: %sR|(2tsalt.configR#R$RR2RBR�R.R0R1tupdatetconfigtload_configtDEFAULT_MINION_OPTStinclude_configR{tcleart
startswithttraceRCRDRIt
dictupdatetargstget_function_argspecR-tplatformtis_proxytinfoRwRtKeyErrorR�t	set_umaskt
is_windowstsalt.modules.cmdmodtmodulestcmdmodt
_run_quietR&R�R�R�tdumpRFR/R}tunlinkR�R�(Rt
force_refreshRPRHR�R�tgrains_deep_mergetpre_optstdefault_includetincludetgrains_dataRRRt
parameterstkwargst	proxytypeR�R�te((s//usr/lib/python2.7/site-packages/salt/loader.pytgrains�s�		











!

cK@sc|jdg�}|jdg�}ttjjtd�g|ddddt�}|||�S(u<
    Directly call a function inside a loader directory
    uargsudirsumodulesR
RWN(R2RR#R$RR%R"RB(tfunR�R�tdirsR((s//usr/lib/python2.7/site-packages/salt/loader.pytcallps	c	C@s||dkri}n|dkr*i}ntt|dddd�|dddi|d6|d6d	|�}||jd
<|S(u<
    Directly call a function inside a loader directory
    urunnersurunnerRurunner_dirsR
Ru	__utils__u__context__R>u__salt__N(R"RR
R(RRIRMR>R((s//usr/lib/python2.7/site-packages/salt/loader.pyRo�s			
cC@s%tt|dddd�|dd�S(u<
    Directly call a function inside a loader directory
    uqueuesuqueueRu
queue_dirsR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pytqueues�sc
C@sb|d	kri}ntt|d�|dddi|d6|d6|d6t||�d6d|�S(
u)
    Make a very small database call
    usdbR
Ru__sdb__u__opts__u	__utils__u__salt__R>N(R"RR
RV(RR\R>RI((s//usr/lib/python2.7/site-packages/salt/loader.pytsdb�s	cC@s1tt|ddtjjtd��|dd�S(uS
    Return modules for SPM's package database

    .. versionadded:: 2015.8.0
    upkgdbRuspmR
(RR
R#R$RR%(R((s//usr/lib/python2.7/site-packages/salt/loader.pytpkgdb�scC@s1tt|ddtjjtd��|dd�S(uP
    Return modules for SPM's file handling

    .. versionadded:: 2015.8.0
    upkgfilesRuspmR
(RR
R#R$RR%(R((s//usr/lib/python2.7/site-packages/salt/loader.pytpkgfiles�sc	C@s�tt|dddtjjtd�dd�|ddditjj|�d6d
d6�}x.t
D]&}tjd	|�|j
|d
�qcW|S(u$
    Return the cloud functions
    ucloudsucloudRRR
Ru	__utils__u__active_provider_name__uZ'%s' has been marked as not supported. Removing from the list of supported cloud functionsN(RR
R#R$RR%RHR]RIR"tLIBCLOUD_FUNCS_NOT_SUPPORTEDR.R�tpop(RR\tfuncname((s//usr/lib/python2.7/site-packages/salt/loader.pytclouds�s 

cC@stt|d�|dd�S(u*
    Return the network api functions
    unetapiR
(RR
(R((s//usr/lib/python2.7/site-packages/salt/loader.pytnetapi�scC@sYtt|dd�|dddi|d6|p1id6|p>id6�}||jd<|S(	u&
    Returns the executor modules
    u	executorsuexecutorR
Ru__salt__u__context__u	__proxy__u
__executors__(RR
R(RR\RMRPt	executors((s//usr/lib/python2.7/site-packages/salt/loader.pyR��s*
c
C@s:tt|dd�|dddi|d6i|d6d6�S(u&
    Returns the returner modules
    ucacheR
Ru__opts__userialu__context__(RR
(RR�((s//usr/lib/python2.7/site-packages/salt/loader.pytcache
s
cB@sf|ejkrdSdj|jd�d�}eje|��}||jfdU|ej|<dS(Nu#'''Salt loaded {0} parent module'''u.i����(tsysR�R&tsplitttypest
ModuleTypetstrt__dict__(R[tcodetmodule((s//usr/lib/python2.7/site-packages/salt/loader.pyt_generate_modulescC@s|jt�rdSdS(Nuintuext(R�R%(tmodule_path((s//usr/lib/python2.7/site-packages/salt/loader.pyt	_mod_type!sRcB@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(ux
    Create a dict which wraps another dict with a specific key suffix on get

    This is to replace "filter_load"
    cC@s||_||_dS(N(RZtsuffix(tselftdR�((s//usr/lib/python2.7/site-packages/salt/loader.pyt__init__.s	cC@s||j|<dS(N(RZ(R�Rtval((s//usr/lib/python2.7/site-packages/salt/loader.pyt__setitem__2scC@s|j|=dS(N(RZ(R�R((s//usr/lib/python2.7/site-packages/salt/loader.pyt__delitem__5scC@s|j||jS(N(RZR�(R�R((s//usr/lib/python2.7/site-packages/salt/loader.pyt__getitem__8scC@s
t|j�S(N(tlenRZ(R�((s//usr/lib/python2.7/site-packages/salt/loader.pyt__len__;scc@sAx:|jD]/}|j|j�r
|j|jd�Vq
q
WdS(Nu(RZtendswithR�treplace(R�R((s//usr/lib/python2.7/site-packages/salt/loader.pyt__iter__>s(	t__name__t
__module__t__doc__R�R�R�R�R�R�(((s//usr/lib/python2.7/site-packages/salt/loader.pyR(s					RcB@s�eZdZejjjZdddddde	dddd�
Z
d�Zd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zdd�ZRS(u�
    A pseduo-dictionary which has a set of keys which are the
    name of the module and function, delimited by a dot. When
    the value of the key is accessed, the function is then loaded
    from disk and into memory.

    .. note::

        Iterating over keys will cause all modules to be loaded.

    :param list module_dirs: A list of directories on disk to search for modules
    :param dict opts: The salt options dictionary.
    :param str tag: The tag for the type of module to load
    :param func mod_type_check: A function which can be used to verify files
    :param dict pack: A dictionary of function to be packed into modules as they are loaded
    :param list whitelist: A list of modules to whitelist
    :param bool virtual_enable: Whether or not to respect the __virtual__ function when loading modules.
    :param str virtual_funcs: The name of additional functions in the module to call to verify its functionality.
                                If not true, the module will not load.
    :returns: A LazyLoader object which functions as a dictionary. Keys are 'module.function' and values
    are function references themselves which are loaded on-demand.
    # TODO:
        - move modules_max_memory into here
        - singletons (per tag)
    umodulecC@s�i|_|dkrin||_|dkr9i}n|jd�}tjjjd|�|_|j	|�|_
||_||_|p�t
|_|p�t|_d|jkr�d|jd<nxdtj|j�D]P\}
}|dkr�|jj|
i�tjjj|j|
�|j|
<q�q�W||_||_t|_i|_i|_t�|_|	rq|	ng|_|dkr�g}n||_t|j
jdj|j|jddkr�dnd�g��|_ i|_!dg|_"x=t#D]5\}}}|||f|j!|<|j"j$|�q�Wt%j&�|_'|j(�t)t*|�j+�t,dj|j��t,d	j|j|��t,d
j|j��t,dj|j|��dS(
uz
        In pack, if any of the values are None they will be replaced with an
        empty context-specific dict
        umultiprocessingt
threadsafeu__context__udisable_{0}{1}i����usuu{0}.intu{0}.int.{1}u{0}.extu{0}.ext.{1}N(-tinject_globalsR"RR2RHRIRMtContextDicttcontext_dictt_LazyLoader__prep_mod_optsRtmodule_dirsR
tLOADED_BASE_NAMER?R�tmod_type_checkRt	iteritemst
setdefaulttNamespacedDictWrapperR>RWR1RNtmissing_modulestloaded_modulestsettloaded_filesR@RsR&tdisabledt
suffix_maptsuffix_ordertSUFFIXESR,t	threadingtRLockt_lockt_refresh_file_mappingtsuperRR�R�(R�R�RR
R?R�RR>RWR@RPRstthreadsafetytktvR�tmodetkind((s//usr/lib/python2.7/site-packages/salt/loader.pyR�asZ				)									
cC@s<tt|�j|�}|jr4t|j�|�S|SdS(u�
        Override the __getitem__ in order to decorate the returned function if we need
        to last-minute inject globals
        N(R�RR�R�tglobal_injector_decorator(R�titemRS((s//usr/lib/python2.7/site-packages/salt/loader.pyR��s	cC@s�|dkrtj||�Sytj||�SWntk
rCnX||jkr�|jr�xQ|j|�D]=}||jkr�qmn|j|�rm||jkrmPqmqmWn||jkr�|j|St|��dS(u�
        Allow for "direct" attribute access-- this allows jinja templates to
        access things like `salt.test.ping()`
        u__getstate__u__setstate__N(u__getstate__u__setstate__(	tobjectt__getattribute__t__getattr__tAttributeErrorR�tloadedt_iter_filesR�RY(R�tmod_nameR[((s//usr/lib/python2.7/site-packages/salt/loader.pyR��s
cC@s�|jd�d}||jkr/dj|�Sy|j|}Wntk
r]dj|�SX|dk	rzdj||�Sdj|�SdS(u�
        Return the error string for a missing function.

        This can range from "not available' to "__virtual__" returned False
        u.iu'{0}' is not available.u%'{0}' __virtual__ returned False: {1}u '{0}' __virtual__ returned FalseN(R�R�R&R�R�R"(R�t
function_nameRtreason((s//usr/lib/python2.7/site-packages/salt/loader.pytmissing_fun_string�s

c@s�|jjdt�tkriy*td�atj�t�|jd<Wqitk
ret	j
d�qiXn|jjdt�tkr�t�|jd<ntr�ddtf|jd<nddt
jf|jd<tjjj�|_g��fd�}x�|jD]�}y#td	�tj|�D��}Wntk
rBqnXtjr�yJgttjtjj|d
���D]}tjjd
|�^qt}Wntk
r�q�X|j|�nx�|D]�}y�tjj|�\}}|jd�r�w�ntjj |�\}	}
tjr�t!j"||	�}	y/t#�j$�j%d�j&d
d�d�}Wn t't(t)fk
r{d}nXy|jdj*|�}Wq�t+k
r�t	j,d||	|�w�q�Xnd}|
|jkr�w�n|	|j-krt	j,d|�w�ntjj||�}
|
dkr�tj|
�}xH|j.D]7}d|krXq@ndj/|�}||kr@Pq@q@Ww�ny&|j|	d}|j|	d}Wnt+k
r�n�Xd||
fkr�||
kr�t	j0d|
|j|	d�ntjr0|
dkr0|dkr0||kraw�qan1|s[|j.j*|
�|j.j*|�kraw�ntjr�|r�|
dkr�w�n|
|
|f|j|	<Wq�tk
r�q�q�Xq�WqWx:|j1D]/}|jd�d}	|ddf|j|	<q�WdS(u7
        refresh the mapping of the FS on disk
        u
cython_enableu	pyximportu.pyxu]Cython is enabled in the options but not present in the system path. Skipping Cython modules.uenable_zip_modulesu.zipuc@s�j|�dS(u
            Hack so we can get the optimization level that we replaced (if
            any) out of the re.sub call below. We use a list here because
            it is a persistent data structure that we will be able to
            access after re.sub is called.
            u(R,(tobj(t	opt_match(s//usr/lib/python2.7/site-packages/salt/loader.pyt_replace_pre_exts
cs@s!|]}|dkr|VqdS(u__pycache__N((t.0tx((s//usr/lib/python2.7/site-packages/salt/loader.pys	<genexpr>su__pycache__u_iu-i����iuoptimization_orderu�Disallowed optimization level %d for module name '%s', skipping. Add %d to the 'optimization_order' config option if you do not want to ignore this optimization level.u,Skipping %s, it is disabled by configurationu__init__{0}iu'Module/package collision: '%s' and '%s'u.pycu.u.oN(2RR2R1t
__import__t	pyximporttinstallttupleR�tImportErrorR.R�t
USE_IMPORTLIBtMODULE_KIND_PKG_DIRECTORYtimpt
PKG_DIRECTORYRHRItodicttOrderedDictRXR�tsortedR#tlistdirR�RtPY3R$RR'R�R�tsplitexttPY3_PRE_EXTtsubR~R�tgrouptrsplitR�t
IndexErrort
ValueErrortindexR�R�R�R�R&R/R@(R�Rtmod_dirR�R	t
pycache_filestfilenametdirnametbasenametf_noexttextt	opt_levelt	opt_indextfpathtsubfilesR�t	init_filetcurr_exttcurr_opt_indextsmod((Rs//usr/lib/python2.7/site-packages/salt/loader.pyR��s�


 
	G

	,




!	+
cC@sj|j�[tt|�j�t�|_i|_i|_t|d�rW|j	�nt
|_WdQXdS(u 
        Clear the dict
        uoptsN(R�R�RR�R�R�R�R�thasattrR�RBRN(R�((s//usr/lib/python2.7/site-packages/salt/loader.pyR��s
		
cC@s�d|jkrM|jdi�|jd<tjjj|jd�|jd<nd|jkr�|jdi�|jd<tjjj|jd�|jd<ni}x<t|j��D](\}}|dkr�q�n|||<q�W|S(u;
        Strip out of the opts any logger instance
        u
__grains__ugrainsu
__pillar__upillarulogger(	RR2R�RHRIRMR�Rdtitems(R�Rtmod_optsRR�((s//usr/lib/python2.7/site-packages/salt/loader.pyt__prep_mod_opts�s%%cc@sk||jkr|Vnx%|jD]}||kr!|Vq!q!Wx%|jD]}||krI|VqIqIWdS(uW
        Iterate over all file_mapping files in order of closeness to mod_name
        N(RX(R�RR�((s//usr/lib/python2.7/site-packages/salt/loader.pyR�sc@sd�fd�t��D�}xA|D]9}|jj�jd�r#t|�|j|�q#q#WdS(Nc3@s9|]/}tt�|��j�rt�|�VqdS(N(RCtgetattrt	__class__(Rtsname(RR(s//usr/lib/python2.7/site-packages/salt/loader.pys	<genexpr>�su.(tdirR�R�Rt_reload_submodules(R�RRt
submodulest	submodule((RRs//usr/lib/python2.7/site-packages/salt/loader.pyR7�s


c(
@s>	d}�j|d \}}�jj|�tjj|�}z�y�tjj|�|dkrt	j
||tj��}n�|dkr�t
|t�t�g�}|jd�}t|�dkr�|}q)|}xP|dD]}t||�}q�Wn,|dkr!t|�j
|�}n�j|}	y.dj�j�j|��j|f�}
Wn8tk
r�dj�j�j|��j|�}
nX|dkr}trItjjtjjftjj tjj!ftjj"tjj#fg}tjj$||�}|j%|
�}
|
dkr*t&��n|
j'j
�}|tj(|
<nt)j
|
d||	�}�j*s)�j+|�q)n�tr�t,|	d|
|�}tj-j.|
|d	|�}
|
dkr�t&��n|
j'j
�}|tj(|
<n=t/j0j1j2||	d��}t)j
|
|||	�}WdQXWn�t3k
r@�n�t&k
r�}d
t4j5|�kr�dj�j|�}t6j7|�|�j8|<nt6j9d�j|d
t:�|�j8|<t;St<k
r�}t6j=d�j|d
t:�|�j8|<t;St>k
r�}y-t?j@tjA�d�d\}}}}Wnt<k
rNnMXtjjddd�}|jB|�r�d|kr�tjCt/jDjEjF�nt6j=d�j|d
t:�|�j8|<t;SXWdtjjG|�XtH|d�r|jIjJ�jK�n�jK|_Ix0t4jL�jM�D]\}}tN|||�q"W|jOjPdd�d}t|dd�}tQjR|�ry|�jK�Wqtk
r�}t6j=|�qt<k
r�d}t6j9d�j||d
t:�|�j8|<|�j8|<t;SXn�jSr�dg�jT}x�|D]�}�jU|||�\}}}} |dk	rrt6jVd�j||�n|t:k	r#|�j8kr#|�j8|<|�j8|<t;Sq#Wnd'} d�jKkr9�jd(kr9tH|d�s�jKdd|jWkr6d|jWkr6d}|�j8|<|�j8|<t;Sq9nt|d t;�t;k	rdt6jXd!|�n|gtY| �}!tZ�fd"�|!D��}"x?t|d t[|��D]%}#|#j\d#�r�q�nt||#�}$tQjR|$�r�t]|$t^j_�r�q�nt|d$i�j`|#|#�}%x�|!D]�}&ydj|&|%f�}'Wn#tk
rhd%j|&|%�}'nX|'�jakr�|$�ja|'<n|%|"|&kr$tN|"|&|%|$�|$|"|&|%<�jb|$|�q$q$Wq�Wytcjd�ja�j|�Wn#tek
r	}t6jXd&|�nXx|!D]}&|"|&�jf|&<q	Wt:S()Niu.pyxu.ou.iu.zipu{0}.{1}.{2}.{3}uR]umagic numberuvFailed to import {0} {1}. Bad magic number. If migrating from Python2 to Python3, remove all .pyc files and try again.uFailed to import %s %s:
R!uCFailed to import %s %s, this is due most likely to a syntax error:
i����usaltuutilsu
process.pyu_handle_signalsu3Failed to import %s %s as the module called exit()
u__opts__u__init__u__init__ faileduError loading %s.%s: %su__virtual__uproxyugrainsu__proxyenabled__u	proxytypeu*u!not a proxy_minion enabled moduleu__load__uTThe functions from module '%s' are being loaded from the provided __load__ attributec3@s0|]&}|�jj|�j��fVqdS(N(R�R2tmod_dict_class(RR	(R�(s//usr/lib/python2.7/site-packages/salt/loader.pys	<genexpr>�su_u__func_alias__u{0}.{1}uBDepends.enforce_dependencies() failed for the following reason: %s((ugrainsuproxy(gR"RXR�taddR#R$R#R�R,Rtload_modulettempfilet
gettempdirR
tglobalstlocalsR�R�R3RR�RR?R�R
RFR&Rt	importlibt	machinerytSourceFileLoadertSOURCE_SUFFIXEStSourcelessFileLoadertBYTECODE_SUFFIXEStExtensionFileLoadertEXTENSION_SUFFIXESt
FileFindert	find_specRR]R�RRNR7tMODULE_KIND_MAPtutiltspec_from_file_locationRHRIR�R�R�Rt	text_typeR.twarningR�R0R1RBR-R/t
SystemExitt	tracebackt
extract_tbR!R�texittdefaultst	exitcodestEX_OKtremoveR/t__opts__R�RR�RtsetattrR�Rtinspectt
isfunctionRWRst_process_virtualR�t__proxyenabled__R�RdRDR6R�RCt	functoolstpartialR2RZt_apply_outputterRtenforce_dependenciestRuntimeErrorR�((R�R[RRR)R�t
fpath_dirnamettop_modtcompstsubnametdesct
mod_namespacetloader_detailstfile_findertspecR]tfn_R:t	error_msgR/t_tcallerttgt_fntp_nametp_valueRtmodule_initR�t
err_stringtvirtual_funcs_to_processtvirtual_functvirtual_rettvirtual_errtvirtual_aliasest	mod_namestmod_dicttattrRSR�ttgt_modt
full_funcname((R�s//usr/lib/python2.7/site-packages/salt/loader.pyRY�sN	


				"



-

	


	
!






#


c@sht�tj�s!td��nd�krEtdj����n�jdd�\}}�j��|�jks���jkr�t	S�j
r�|�j
kr�tjd�|�j
�t���n��fd�}d}t}xtt	r]y:||�}|r(|t	k	r(�j�t	}w�nPWq�tk
rY|s��j�t	}q�q�q�Xq�WWdQX|S(u3
        Load a single item if you have it
        uThe key must be a string.u.u"The key '{0}' should contain a '.'iuNFailed to load function %s because its module (%s) is not in the whitelist: %sc@sUxN�j|�D]=}|�jkr+qn�j|�r��jkrtSqWtS(N(RR�RYRZR1RB(RR[(RR�(s//usr/lib/python2.7/site-packages/salt/loader.pyt_inner_load�sN(RCRtstring_typesR�R&R�R�R�RZR1R>R.R/R"RBR�R�(R�RRRnRRtreloaded((RR�s//usr/lib/python2.7/site-packages/salt/loader.pyt_load�s<

	


	cC@sb|j�SxB|jD]7}||jks||jkr>qn|j|�qWt|_WdQXdS(u"
        Load all of them
        N(R�RXR�R�RYR1R�(R�R[((s//usr/lib/python2.7/site-packages/salt/loader.pyR�s
cC@s*|j�t�|_|j�WdQXdS(N(R�R�R�R(R�((s//usr/lib/python2.7/site-packages/salt/loader.pytreload_moduless
cC@sAt|d�r=|j}|j|kr=||j|_q=ndS(uC
        Apply the __outputter__ variable to the functions
        u
__outputter__N(R/t
__outputter__R�(R�RSRRtoutp((s//usr/lib/python2.7/site-packages/salt/loader.pyR`
s	u__virtual__cC@s�t|dt��}yd}t|d�r+tj|j�r+y�tj�}t||��}t|t�r�|d}|d}n|j	j
dt�r�tj�|}dj||�}	t
j|	�nWnDtk
r}
dj|j|
�}t
j|dtj�d}nXt|d	|�}|sb|dkrRt
jd
|j|�nt|||fS|tk	r�||kr�t
jd||�t|d	�s�tjjjdd
j|j||��n||kr�t
jd|j||�n|}q+|tkr+||kr+|tk	r(|}q(q+nWn`tk
rUt
jd|dt�n:tk
r�t
jd|j|dt�t|||fSXt|d|fS(u"
        Given a loaded module and its default name determine its virtual name

        This function returns a tuple. The first value will be either True or
        False and will indicate if the module should be loaded or not (i.e. if
        it threw and exception while processing its __virtual__ function). The
        second value is the determined virtual name, which may be the same as
        the value provided.

        The default name can be calculated as follows::

            module_name = mod.__name__.rsplit('.', 1)[-1]
        u__virtual_aliases__u__virtual__iiu
virtual_timeru)Virtual function took {0} seconds for {1}u]Exception raised when processing __virtual__ function for {0}. Module will not be loaded: {1}texc_info_on_loglevelu__virtualname__u�%s.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module '%s', please fix this.uLoaded %s as virtual %suHydrogenu�The '{0}' module is renaming itself in its __virtual__() function ({1} => {2}). Please set it's virtual name as the '__virtualname__' module attribute. Example: "__virtualname__ = '{2}'"u�The module '%s' is showing some bad usage. Its __virtualname__ attribute is set to '%s' yet the __virtual__() function is returning '%s'. These values should match!uKeyError when loading %sR!u.Failed to read the virtual function for %s: %sN(R3R
R"R/RZR[t__virtual__RRCRR2RBR&R.ROR-R�R/tloggingtDEBUGR1R�RHRItversionst
warn_untilR�R0R
(R�RRRRvRyterror_reasontstarttvirtualtendtmsgR:tvirtualname((s//usr/lib/python2.7/site-packages/salt/loader.pyR\sh!



	

N(R�R�R�RHRIRRR:R"R1R�R�R�RR�R�R�RR7RYR�RR�R`R\(((s//usr/lib/python2.7/site-packages/salt/loader.pyRDs4G				�				
	�	5				c@s�fd�}|S(u�
    Decorator used by the LazyLoader to inject globals into a function at
    execute time.

    globals
        Dictionary with global variables to inject
    c@s%tj����fd��}|S(Nc@s0tjjj�����||�SWdQXdS(N(RHRIRMtfunc_globals_inject(R�R�(tfR�(s//usr/lib/python2.7/site-packages/salt/loader.pytwrapper�s(R^twraps(R�R�(R�(R�s//usr/lib/python2.7/site-packages/salt/loader.pytinner_decorator�s!((R�R�((R�s//usr/lib/python2.7/site-packages/salt/loader.pyR��s(�R�t
__future__RRRR#treR�RR�RZR=R^R�RQR�t	zipimportRR�RHtsalt.defaults.exitcodest
salt.syspathstsalt.utils.argstsalt.utils.contexttsalt.utils.datatsalt.utils.dictupdatetsalt.utils.eventtsalt.utils.filestsalt.utils.lazytsalt.utils.odicttsalt.utils.platformtsalt.utils.versionstsalt.exceptionsRt
salt.templateRtsalt.utils.decoratorsRtsalt.extRtsalt.ext.six.movesRtversion_infotimportlib.machineryRAtimportlib.utilR1RRRBtcollections.abcR	RtcollectionsR)R(t	getLoggerR�R.R$tabspathtsyspathstINSTALL_DIRR%R�tMODULE_KIND_SOURCEtMODULE_KIND_COMPILEDtMODULE_KIND_EXTENSIONRR�RBRHR�R,RDRFRCRERGRKtget_suffixestcompileR&RR�R"RRR R
RVRER^R_RaRPRbRIRcRfRgRiRjRkRlRnRpRqRrRtRuRvRzR{R�R�R�RoR�R�R�R�R�R�R�R�R�R�RtlazytLazyDictRR�(((s//usr/lib/python2.7/site-packages/salt/loader.pyt<module>s	





		)K		

			
	
		
		%�									���R

Zerion Mini Shell 1.0