HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/__pycache__/__init__.cpython-310.pyc
o

;j���@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
ZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZddlmZddlmZddlm Z m!Z!m"Z"e�#e$�Z%d	Z&ge'e d
��e'e d��e'e d��e'e d
dd��e'e dd��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d��e'e d ��e'e d!��e'e d"��e'e d#��e'e d$��e'e d%d&��e'e d%d'��e'e d(��e'e d)��e'e d*��e'e d+��e'e d,��e'e d-��RZ(			.				did/d0�Z)			.			.djd1d2�Z*				3		3			dkd4d5�Z+dld6d7�Z,dmd8d�Z-dmd9d�Z.dnd:d�Z/						;	dod<d�Z0	dpd=d �Z1						dqd>d,�Z2dnd?d@�Z3dmdAd+�Z4drdBdC�Z5dmdDdE�Z6dmdFd$�Z7dmdGdH�Z8dndId
�Z9dmdJd�Z:dpdKd!�Z;dmdLd)�Z<					dsdMd(�Z=drdNd�Z>dmdOd�Z?	dpdPdQ�Z@					dsdRdS�ZAdrdTdU�ZBdVdW�ZCdXdY�ZDdtdZd�ZEd[d\�ZFdpd]d^�ZGdmd_d�ZHdpd`d#�ZIdmdad&�ZJdmdbd'�ZKdmdcd�ZLdmddd�ZMdpded�ZNdmdfd�ZOejPdgdh��ZQdS)uz�
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.
�N)�OrderedDict)�LoaderError�SaltDeserializationError)�check_render_pipe_str)�entrypoints�)�SALT_BASE_PATH�FilterDictWrapper�
LazyLoader)zparallels.avail_sizeszparallels.avail_locationszproxmox.avail_sizes�auth�beacons�cache�client�ssh�wrapper�cloud�clouds�engines�	executors�
fileserver�grains�log_handlers�matchers�	metaproxy�modules�netapi�output�pillar�proxy�queues�	renderers�	returners�roster�runners�sdb�serializers�spm�pkgdb�pkgfiles�states�thorium�tokens�tops�utils�wheelTc

	CsVtt|||||||�||||	d�}
i}|
��|rt|
|�}
|
D]}|
|||<q |S)N��tag�pack�loaded_base_name)r
�_module_dirsZ	_load_allr	)
�opts�ext_typer0r1�int_type�ext_dirs�
ext_type_dirs�	base_pathZfilter_namer2�funcs�ret�key�r=�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/__init__.py�
static_loaderTs,�	�
r?c
CsZ|dur|}tj�|ptt�|p|�g}|�d�r$tj�|d|�g}	ng}	|d�t�s7td�	|dt
���g}
|�rQ|durE|�d�}||vrP|
�||�|�rQ|du�rQt�
d�D]�}t|��}|��}
Wd�n1srwY|jr{q]t�}t|
tj�r�t|��}|
�}Wd�n1s�wY|jr�q]t|t�r�||vr�q]t|��}t||t�r�td��||D]}|�|�q�Wd�n1s�wYni|j|kr�q]|D]}|�|�q�nXt|
tj��r)|
jD]7}t|��}tj�||�}tj�|��s
	Wd�q�Wd�n	1�swY|j�r"q�|�|�q�nt|��td�	|
���1�s9wY|D]}tj�|��rN|
�|��q@q]g}|�d	g�D]0}tj�||�}tj�|��rq|�d|��qYtj�|d
|���}tj�|��r�|�d|��qY|�di��dd
��r�tj j!�"dd�||
|	|S||	|
|S)NZextension_modulesrz�{!r} is not considered a salt internal loader path. If this is a new loader being added, please also add it to {}.SALT_INTERNAL_LOADERS_PATHS.Z_dirsTzsalt.loaderzRThe callable must return an iterable of strings. A single string is not supported.z/Don't know how to load a salt extension from {}�module_dirs�_ZfeaturesZ-enable_deprecated_module_search_path_priorityFi�z�The old module search path priority will be removed in Salt 3008. For more information see https://github.com/saltstack/salt/pull/65938.)#�os�path�join�strr�get�
startswith�SALT_INTERNAL_LOADERS_PATHS�RuntimeError�format�__name__�extendrZiter_entry_points�catch_entry_points_exception�load�exception_caught�set�
isinstance�types�FunctionType�dict�
ValueError�add�name�
ModuleType�__path__�exists�append�isdir�insert�saltr-ZversionsZ
warn_until)r4r5r0r6r7r8r9�load_extensionsZ	sys_typesZ	ext_typesZext_type_types�entry_point�ctxZloaded_entry_pointZloaded_entry_point_pathsZloaded_entry_point_valuerCZloaded_entry_point_pathZ!entry_point_ext_type_package_pathZcli_module_dirsZ_dirZ	maybe_dirr=r=r>r3xs�

�


�
�

����
�

����
���
�����r3Fc
Cs@|s|�dd�}tt|dd�|d|||||	d�||||r|jnddd�	}
|r0t|t�r0|
|jd<|�dd	�}|rqt|t�rq|D]1}z
t||||
�}
Wn
tyUYnw|
rp|
D]}d
�	|||�
d�d��}|
||
|<qZq?|r�ddl}|jj
jd
|d	d��}|jddi|jjjd�Wd�|
S1s�wY|
S)a�
    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: The imported modules namespace when imported
                                 by the salt loader.
    :param bool notify: Flag indicating that an event should be fired upon
                        completion of module loading.


    Example:

    .. 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']()
    Zwhitelist_modulesNr�module)�__context__�	__utils__�	__proxy__Z__opts__�__file_client__�__salt__)r0r1�	whitelistr2�static_modules�extra_module_dirs�	pack_self�	providersFz{}{}�.rZminion)r4�listenZcompleteT)r0)rFr
r3r@rQr1rT�raw_mod�	TypeErrorrJ�rindexZsalt.utils.eventr-�eventZ	get_eventZ
fire_event�defaults�eventsZMINION_MOD_REFRESH_COMPLETE)r4�contextr-rhZinitial_loadr2�notifyrir�file_clientr;rl�modr:�funcZf_keyr^Zevtr=r=r>�minion_mods
sV3
��
���
��rzcsPtt||d�|ddd|i|d��|�jvriS��|�t�fdd��jD��S)a�
    Returns a single module loaded raw and bypassing the __virtual__ function

    :param dict opts: The Salt options dictionary
    :param str name: The name of the module to load
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param str mod: The extension type.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.

    Example:

    .. 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']()
    rbZ	rawmoduleFrg)r0�virtual_enabler1r2csi|]}|�|�qSr=r=)�.0�x��loaderr=r>�
<dictcomp>�szraw_mod.<locals>.<dictcomp>)r
r3Zfile_mappingZ_load_modulerT�_dict)r4rW�	functionsrxr2r=r~r>rors
�
	
rocC�tt|d�|d|d�S)z�
    Return functions used in the meta proxy

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r�r0r2�r
r3�r4r2r=r=r>r���cCr�)z�
    Return the matcher services plugins

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    rr�r�r�r=r=r>r�r�cCs8||||d�}tt|d�|d||r|j|d�Sd|d�S)a!
    Return the engines plugins

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param LazyLoader runners: A LazyLoader instance returned from ``runner``.
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    )rgZ__runners__rerdrN�r0r1rjr2�r
r3r@)r4r�r#r-rr2r1r=r=r>r�s 
���rec	Cs0tt|d�|d||||d�|r|jnd||d�S)aq
    Returns the proxy module for this salt-proxy-minion

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param LazyLoader returners: A LazyLoader instance returned from ``returners``.
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r)rgZ__ret__rdrcN�r0r1rjrkr2r�)r4r�r!rhr-rurkr2r=r=r>r�s��c	Cs(tt|dd�|d||||pid�|d�S)aZ
    Returns the returner modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param list whitelist: A list of modules which should be whitelisted.
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r!Zreturner�rgrcre�r0rhr1r2r�)r4r�rhrurr2r=r=r>r!�s
�c
Cs0tt|dddd�|d|||pi|d�||dd�S)a
    Returns the utility modules

    :param dict opts: The Salt options dictionary
    :param list whitelist: A list of modules which should be whitelisted.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r-Z
utils_dirsF)r8r_)rcrerf)r0rhr1rkr2Z(_only_pack_properly_namespaced_functionsr�)r4rhrurrwrkr2r=r=r>r-s��c	Cs8t|�}tt|d�|d|||d�|jd|d�}t|d�S)a�
    Returns the pillars modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r)rgrcrdZ__ext_pillar__r�z.ext_pillar)r-r
r3r@r	)r4r�rur2�_utilsr;r=r=r>�pillars9s
�
	r�cCs@d|vriSt|d���}tt|dd�|d||d�}t|d�S)z�
    Returns the tops modules

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Zmaster_topsr,�top)r0rhr2z.top)�list�keysr
r3r	)r4r2rhr;r=r=r>r,Qs
�
cCs*|duri}tt|d�|d|d|i|d�S)a�
    Returns the wheels modules

    :param dict opts: The Salt options dictionary
    :param list whitelist: A list of modules which should be whitelisted.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nr.rcr�r�)r4rhrur2r=r=r>�wheelsfs�r�cCs2tt|ddd�|d|d�}t|d�}||jd<|S)a.
    Returns the outputters modules

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    :returns: LazyLoader instance, with only outputters present in the keyspace
    rZoutputter_dirs�r8r�z.outputrg)r
r3r	r1)r4r2r;Zwrapped_retr=r=r>�
outputters}s	�

r�cCr�)a/
    Returns the serializers modules
    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    :returns: LazyLoader instance, with only serializers present in the keyspace
    r%r�r�r�r=r=r>r%�r�cCr�)a-
    Returns the tokens modules
    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    :returns: LazyLoader instance, with only token backends present in the keyspace
    r+r�r�r�r=r=r>�eauth_tokens�r�r�cCs"tt|d�|d|dt|�i|d�S)a�
    Returns the auth modules

    :param dict opts: The Salt options dictionary

    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param list whitelist: A list of modules which should be whitelisted.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    :returns: LazyLoader
    rrgr�)r
r3rz)r4rhr2r=r=r>r�s
�c	Cs�t|�}|dur@t|t�s|g}t�}t�d�}|D]!}|�|�}|r6|�|�d��|�|�d�d�q|�|�qt|�}t	t
|d�|d|d|i|j|d�S)a
    Returns the file server modules

    :param dict opts: The Salt options dictionary
    :param list backends: List of backends to load.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nz^(git|svn|hg)(?:fs)?$r�fsrrd�r0rhr1rjr2)r-rQr�rP�re�compile�matchrV�groupr
r3r@)r4Zbackendsr2r�Zbackend_setZvcs_reZbackendr�r=r=r>r�s,	


�c	Cs2tt|d�|d|||d�|r|j|d�Sd|d�S)a�
    Returns the roster modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader runner: A LazyLoader instance returned from ``runner``.
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param list whitelist: A list of modules which should be whitelisted.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r")�
__runner__rdNr�r�)r4�runnerr-rhr2r=r=r>r"�s��cCs2||id�}tt|d�|d||d�}||jd<|S)a�
    Load the thorium runtime modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param LazyLoader runners: A LazyLoader instance returned from ``runner``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    )rgr�rcr*r/Z__thorium__)r
r3r1)r4r�r#r2r1r;r=r=r>r*s
�
c		CsF|duri}tt|d�|d||pi||||d�||r|jndd|d�S)a&
    Returns the state modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param LazyLoader runners: A LazyLoader instance returned from ``runner``.
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param LazyLoader serializers: An optional LazyLoader instance returned from ``serializers``.
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param list whitelist: A list of modules which should be whitelisted.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.

    .. code-block:: python

        import salt.config
        import salt.loader

        __opts__ = salt.config.minion_config('/etc/salt/minion')
        statemods = salt.loader.states(__opts__, None, None)
    Nr))rgrerdZ__serializers__rcrf�
__states__�r0r1rhrjrkr2r�)	r4r�r-r%rhrrur2rwr=r=r>r)s$"��cCs&tt|d�|d|||pid�g|d�S)a
    Load the beacon modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r)rcrgre)r0r1Z
virtual_funcsr2r��r4r�rurr2r=r=r>rSs�cCs tt|d�|d|d�}t|d�S)z�
    Returns the custom logging handler modules

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    rr�z.setup_handlers)r
r3r	)r4r2r;r=r=r>ris��
	cCs0tt|dttdd�d�|d|||d�|d�S)a�
    Returns the custom logging handler modules

    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    rrr�r9)rgrcrfr/�r
r3rEr)r4r�rurwr2r=r=r>�ssh_wrapper}s���r�cCs�|duri}||�di�||d�}|r||d<|duri}||d<tt|dddd	�|d||d
�}t|d�}	t|d|	|d
|d�sRd�|d�}
t�|
�t|
��|	S)a\
    Returns the render modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param LazyLoader states: A LazyLoader instance returned from ``states``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nr)rgZ
__grains__rcrfr�rer �renderZrender_dirsr�r/z.renderZrendererZrenderer_blacklistZrenderer_whitelistz^The renderer {} is unavailable, this error is often because the needed software is unavailable)	rFr
r3r	rrJ�log�criticalr)r4r�r)rrurwr2r1r;Zrend�errr=r=r>r��sD
���
�
�
r�cCsNt||d�}t||d�|d�}tt|dddd�|d|j||d�}||jd<|S)	a�
    Returns the grain functions

    :param dict opts: The Salt options dictionary
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.

      .. code-block:: python

          import salt.config
          import salt.loader

          __opts__ = salt.config.minion_config('/etc/salt/minion')
          grainfuncs = salt.loader.grain_funcs(__opts__)
    )r�rdrcrZgrainZgrains_dirsr�)r0rjr1r2rd)r-r
r3r@r1)r4rrur2r�r1r;r=r=r>�grain_funcs�s"��

r�cCs,|�d�r|d}t|t�rt|�|d<|S)z>
    Returns cached grains with fixed types, like tuples.
    �osrelease_info)rFrQr��tuple)�
cached_grainsr�r=r=r>�_format_cached_grainss


r�c	Cstj�|�s
t�d�dStt��tj�|��}||�dd�kr.t�d||�dd��dS|�dd�r;t�d�dSt�d	�z4t	j
j�|d
��}t	j
j
jt	j�|�dd�}Wd�n1sawY|spt�d
�WdSt|�WSttfy�YdSw)z`
    Returns the grains cached in cfn, or None if the cache is too old or is
    corrupted.
    z!Grains cache file does not exist.NZgrains_cache_expirationi,znGrains cache last modified %s seconds ago and cache expiration is set to %s. Grains cache expired. Refreshing.Zrefresh_grains_cacheFz+refresh_grains_cache requested, Refreshing.zRetrieving grains from cache�rbT�Zpreserve_tuplesz>Cached grains are empty, cache might be corrupted. Refreshing.)rBrC�isfiler��debug�int�time�getmtimerFr^r-�files�fopen�data�decode�payloadrNr��OSErrorr)r4�cfnZgrains_cache_age�fp_r�r=r=r>�_load_cached_grainss8

�

��

�r�cCsbddl}tj�|dd�}|s|�dd�rt||�}|r|Snt�d�|�dd�r,iS|�d	d�d
u}d|vr�i}	|	�|j	�
|dd|j	jd��|	�d
|d
�}
|	�dg�}|	�|j	j|
|ddd��|	�|j	j||dd
d��d|	vr�|	d|d<n	i|d<ni|d<i}|�dg�}
t
|||p�i|d�}|r�|��|D]K}|�d�s�q�t�d|�||�}t|t�s�q�|
r�t|�D]}|
D]}|jj�||�r�||=t�d|�q�q�|s�q�|r�|jj�||�q�|�|�q�|D]�}|�d�s�|dkr�q�z-t�d|�t�||�j}i}d|v�r||d<d|v�r ||d<||d'i|��}Wn!t�yK|jj���r>t�d�tjd|||d
d�Yq�wt|t��sSq�|
�rzt|�D]}|
D]}|jj�||��rr||=t�d|��q^�qZ|�szq�|�r�|jj�||�q�|�|�q�|�dd
��r�|�r�zR|j dd}|d|v�r�|d|v�r�||d��r�z!|j dd}||d�}|�r�|jj�||�n|�|�Wnt�y�tjdd
d�YnwWn
t!�y�Ynw|�|d�|�dd��r�|jj"�#d ��~zO|jj�$��r ddl%}|j&j'�(d!|�d"��|jj"�)|d#��&}z	|j*�+||�Wnt,�yF}zt�-d$|��d}~wwWd�n	1�sRwYWn&t�y~}zt�-d%||�tj�.|��rtt�/|�WYd}~nd}~wwWd�n	1�s�wY|�r�|jj�||d�n|�|d�|�0�|jj1j2|d
d&�S)(a6
    Return the functions for the dynamic grains and the values for the static
    grains.

    :param dict opts: The Salt options dictionary
    :param bool force_refresh: Force the refresh of grains
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.

    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']
    rNZcachedirzgrains.cache.pZgrains_cacheFz,Grains refresh requested. Refreshing grains.Zskip_grains�grains_deep_mergeTZ	conf_fileZSALT_MINION_CONFIG�default_include�include)�verboserZgrains_blacklist)rrur2zcore.zLoading %s grainzFiltering %s grain�_errorsrzdThe following CRITICAL message may not be an error; the proxy may not be completely established yet.zFFailed to load grains defined in grain file %s in function %s, error:
)�exc_infoZproxy_merge_grains_in_module�	proxytypez.grainsz.initializedz&Failed to run proxy's grains function!�?zattrib -R "�"zw+bz$Failed to serialize grains cache: %sz+Unable to write to grains cache file %s: %sr�r=)3�salt.configrBrCrDrFr�r�r��updateZconfigZload_configZDEFAULT_MINION_OPTSZinclude_configr��clearrG�tracerQrTr�r-ZstringutilsZ
expr_matchZ
dictupdate�inspectZ	signature�
parameters�	Exception�platformZis_proxy�infor�r4�KeyErrorr�Z	set_umaskZ
is_windowsZsalt.modules.cmdmodrZcmdmodZ
_run_quietr�r��dumprp�errorr��unlinkZ
clean_modulesr�r�)r4Z
force_refreshrrur2r^r�r�r�Zpre_optsr�r�Zgrains_dataZblistr:r<r;�blockr��kwargsr�r��er=r=r>r2s6
�

��
���
�


��

������
�
���������
����cKsP|�dg�}|�dg�}|�dd�}tttd�g|ddd|d�}|||�S)z<
    Directly call a function inside a loader directory
    �args�dirsr2NrF)r0r{r2)rF�popr
rEr)Zfunr�r�r�r2r:r=r=r>�call�s�r�c
CsL|duri}|duri}tt|dddd�|d||d�||r |jndd|d�S)	a
    Directly call a function inside a loader directory

    :param dict opts: The Salt options dictionary
    :param list whitelist: A list of modules which should be whitelisted.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nr#r�Zrunner_dirsr�r�rgr�r�)r4r-rurhr2r=r=r>r�s�r�cCstt|dddd�|d|d�S)z�
    Directly call a function inside a loader directory

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r�queueZ
queue_dirsr�r�r�r�r=r=r>r-s�c
CsH|duri}tt|d�|d||t||d�d�||r|j|d�Sd|d�S)a�
    Make a very small database call

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param list whitelist: A list of modules which should be whitelisted.
    :param LazyLoader utils: A LazyLoader instance returned from ``utils``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nr$)r-)Z__sdb__rdrg)r0r1rhrjr2)r
r3rzr@)r4r�rhr-r2r=r=r>r$=s"
��
�cC�"tt|dttd�d�|d|d�S)a	
    Return modules for SPM's package database

    .. versionadded:: 2015.8.0

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r'r&r�r�r�r�r=r=r>r'Zs
�cCr�)a
    Return modules for SPM's file handling

    .. versionadded:: 2015.8.0


    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r(r&r�r�r�r�r=r=r>r(ls�cCs`t|�}tt|ddttd�dd�|d|dd�|j|d�}tD]}t�d|�|�	|d�q|S)z�
    Return the cloud functions

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    rr)r9r6N)rdZ__active_provider_name__r�zZ'%s' has been marked as not supported. Removing from the list of supported cloud functions)
r-r
r3rErr@�LIBCLOUD_FUNCS_NOT_SUPPORTEDr�r�r�)r4r2r�r��funcnamer=r=r>rs,
���cCr�)z�
    Return the network api functions

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    rr�r�r�r=r=r>r�r�cCs<|duri}|duri}tt|dd�|d|||d�d|d�S)a
    Returns the executor modules

    :param dict opts: The Salt options dictionary
    :param LazyLoader functions: A LazyLoader instance returned from ``minion_mods``.
    :param dict context: A Salt context that should be made present inside
                            generated modules in __context__
    :param LazyLoader proxy: An optional LazyLoader instance returned from ``proxy``.
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    Nr�executorr�Z
__executors__)r0r1rkr2r�r�r=r=r>r�s

�cCstt|dd�|d|d�S)z�
    Returns the returner modules

    :param dict opts: The Salt options dictionary
    :param str loaded_base_name: The imported modules namespace when imported
                                 by the salt loader.
    r
r�r�r�r=r=r>r
�s
�c
csl�tjdd�}z|VWdSty5}zd|_t�|�}tjd|j|j	|t
jd�WYd}~dSd}~ww)NF)rOTz3Error processing Salt Extension %s(version: %s): %s)Zexc_info_on_loglevel)rR�SimpleNamespacer�rOrZ!name_and_version_from_entry_pointr�r�rW�version�logging�DEBUG)r`ru�excZentry_point_detailsr=r=r>rM�s �
���rM)NNTNNNN)NNTNNT)	NNNFNFNNN)rN)N)NN)NNNNNreN)NNNN)NNNNNN)NNN)NNNNN)FNNN)R�__doc__�
contextlibr�r�rBr�r�rR�collectionsrr�r^Zsalt.defaults.eventsZsalt.defaults.exitcodesZsalt.loader.contextZ
salt.syspathsZsalt.utils.contextZsalt.utils.dataZsalt.utils.dictupdateZsalt.utils.filesZsalt.utils.lazyZsalt.utils.platformZsalt.utils.stringutilsZsalt.utils.versionsZsalt.exceptionsrrZ
salt.templaterZ
salt.utilsrZlazyrr	r
�	getLoggerrKr�r�rErHr?r3rzrorrrrr!r-r�r,r�r�r%r�rrr"r*r)rrr�r�r�r�r�rr�r�rr$r'r(rrrr
�contextmanagerrMr=r=r=r>�<module>sn

�
�
���
�
�
�
	�

�
�
�

�
�
�
�
�
�
�
�
�
�
�
���
�
�
�
�
�
 �(
�'
�
�
h
(


�'
�
�
$







'

�
8

� 
�
@&
'M






$