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

�N�g�2�@s4dZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlZddl
ZddlmZddlmZe�e�ZddiZd&dd	�Zd'd
d�Zd'dd
�Z						d(dd�Zd'dd�Zd'dd�Zd'dd�Zd)dd�Zd'dd�Zd*dd�Z d*dd�Z!d*dd �Z"d*d!d�Z#d*d"d#�Z$d+d$d%�Z%dS),z!
Return cached data from minions
�N)�SaltInvocationError)�
clear_lock�list_�list�globcKs$tjjj||ddtd�}|��}|S)a�
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Return cached grains of the targeted minions.

    tgt
        Target to match minion ids.

        .. versionchanged:: 2017.7.5,2018.3.0
            The ``tgt`` argument is now required to display cached grains. If
            not used, the function will not return grains. This optional
            argument will become mandatory in the Salt ``3001`` release.

    tgt_type
        The type of targeting to use for matching, such as ``glob``, ``list``,
        etc.

    CLI Example:

    .. code-block:: bash

        salt-run cache.grains '*'
    TF)�use_cached_grains�grains_fallback�opts)�salt�utils�master�MasterPillarUtil�__opts__Zget_minion_grains)�tgt�tgt_type�kwargs�pillar_utilZ
cached_grains�r�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/cache.py�grainss

�rc	Ks(tjjj||ddddtd�}|��}|S)ak
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Return cached pillars of the targeted minions if tgt is set.
    If tgt is not set will return cached pillars for all minions.

    CLI Example:

    .. code-block:: bash

        salt-run cache.pillar
    TF�rrZuse_cached_pillarZpillar_fallbackr	)r
rrr
rZget_minion_pillar)rrrrZ
cached_pillarrrr�pillar=s�	rc	Ks(tjjj||ddddtd�}|��}|S)a
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Return cached mine data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.mine
    Fr)r
rrr
rZget_cached_mine_data)rrrrZcached_minerrr�mineYs�	rFc	Cs:|durdStjjj||ddddtd�}|j||||d�S)z?
    Clear the cached data/files for the targeted minions.
    NFTr)�clear_pillar�clear_grains�
clear_mine�clear_mine_func)r
rrr
rZclear_cached_minion_data)rr�clear_pillar_flag�clear_grains_flag�clear_mine_flag�clear_mine_func_flagrrrr�_clear_cachets"�	�r!cC�t||dd�S)a'
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Clear the cached pillar data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.clear_pillar
    T)r�r!�rrrrrr��rcCr")a'
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Clear the cached grains data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.clear_grains
    T)rr#r$rrrr�r%rcCr")a#
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Clear the cached mine data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.clear_mine
    T)rr#r$rrrr�r%rcCst|||d�S)ac
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Clear the cached mine function data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.clear_mine_func tgt='*' clear_mine_func_flag='network.interfaces'
    )r r#)rrr rrrr�r%rcCst||dddd�S)a6
    .. versionchanged:: 2017.7.0
        The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
        releases must use ``expr_form``.

    Clear the cached pillar, grains, and mine data of the targeted minions

    CLI Example:

    .. code-block:: bash

        salt-run cache.clear_all
    T)rrrr#r$rrr�	clear_all�s�r&c	Ks�tjjjdi|��}tjj�|�dgd���}|r tjj�|�|dkr9tjjjt	t	dtj
jjtj
jjd�g}n|dkrug}t	dD]0}t
t|��}|dkrst|dt�sWqCtjjjt	|dtjjjtjjjtjjjd	�}|�|�qCnC|d
kr�t	d}t	d}	g}|	|ft	d
t	dffD]\}
}tjjjt	|
tjjjtjjjtjjj|d�}|�|�q�ntd|�d���i}|D](}|D]#}
t|j|||
d�\}}|r�|�dg��|�|r�|�dg��|�q�q�|s�dS|S)a�
    .. versionadded:: 2015.8.2

    Remove the update locks for Salt components (gitfs, git_pillar, winrepo)
    which use gitfs backend code from salt.utils.gitfs.

    .. note::
        Running :py:func:`cache.clear_all <salt.runners.cache.clear_all>` will
        not include this function as it does for pillar, grains, and mine.

        Additionally, executing this function with a ``role`` of ``gitfs`` is
        equivalent to running ``salt-run fileserver.clear_lock backend=git``.

    role
        Which type of lock to remove (``gitfs``, ``git_pillar``, or
        ``winrepo``)

    remote
        If specified, then any remotes which contain the passed string will
        have their lock cleared. For example, a ``remote`` value of **github**
        will remove the lock from all github.com remotes.

    type : update,checkout,mountpoint
        The types of lock to clear. Can be one or more of ``update``,
        ``checkout``, and ``mountpoint``, and can be passed either as a
        comma-separated or Python list.

        .. versionadded:: 2015.8.8
        .. versionchanged:: 2018.3.0
            ``mountpoint`` lock type added

    CLI Examples:

    .. code-block:: bash

        salt-run cache.clear_git_lock gitfs
        salt-run cache.clear_git_lock git_pillar
        salt-run cache.clear_git_lock git_pillar type=update
        salt-run cache.clear_git_lock git_pillar type=update,checkout
        salt-run cache.clear_git_lock git_pillar type='["update", "mountpoint"]'
    �type)�updateZcheckoutZ
mountpoint�gitfsZ
gitfs_remotes)�per_remote_overrides�per_remote_only�
git_pillar�
ext_pillar�git)r*r+�global_only�winrepo�winrepo_dir�winrepo_remotesZwinrepo_remotes_ngZwinrepo_dir_ng)r*r+r/Z
cache_rootzInvalid role '�')�remote�	lock_type�cleared�errorszNo locks were removedNr)r
r�argsZclean_kwargsZsplit_input�popZinvalid_kwargsr)ZGitFSrZ
fileserverZPER_REMOTE_OVERRIDESZPER_REMOTE_ONLY�next�iter�
isinstancerZ	GitPillarrr,ZGLOBAL_ONLY�appendZWinRepoZrunnersr0r�_clear_lockr�
setdefault�extend)Zroler4rZtype_Zgit_objectsr-�key�objr1r2Zremotes�base_dir�retr5r6r7rrr�clear_git_lock�s�*����
��
���

���rEc
Cs�t|t�siStj�tj�tj�t	d�d��}|�
d�siStd||d�}|dur-iSi}|��D]&\}}|��D]\}}|��D]\}}	t
�
||�rW|	||<|||d<qCq;q3|S)aA
    Return cloud cache data for target.

    .. note:: Only works with glob matching

    tgt
      Glob Target to match minion ids

    provider
      Cloud Provider

    CLI Example:

    .. code-block:: bash

        salt-run cache.cloud 'salt*'
        salt-run cache.cloud glance.example.org provider=openstack
    Z	conf_file�cloudZupdate_cachedirzcloud.list_cache_nodes_full)r	�providerNrG)r<�strr
ZconfigZcloud_config�os�path�join�dirnamer�getZ	__utils__�items�fnmatch)
rrGr	Zcloud_cacherDZdriverZ	providersZservers�name�datarrrrF[s*
�
���rFcCsR|durtd}z
tjjt|d�}Wnty!tj�t�}Ynw|�|||�S)z�
    Lists entries stored in the specified bank.

    CLI Example:

    .. code-block:: bash

        salt-run cache.store mycache mykey 'The time has come the walrus said'
    N�cachedir�rR)rr
�cache�Cache�	TypeError�store)�bankrArQrRrTrrrrW�s
�rWcCsN|durtd}z
tjjt|d�}Wnty!tj�t�}Ynw|�|�S)z�
    Lists entries stored in the specified bank.

    CLI Example:

    .. code-block:: bash

        salt-run cache.list cloud/active/ec2/myec2 cachedir=/var/cache/salt/
    NrRrS)rr
rTrUrVr)rXrRrTrrrr�s
�
cC�P|durtd}z
tjjt|d�}Wnty!tj�t�}Ynw|�||�S)z�
    Fetch data from a salt.cache bank.

    CLI Example:

    .. code-block:: bash

        salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
    NrRrS)rr
rTrUrV�fetch�rXrArRrTrrrrZ�s
�rZcCrY)ao
    Remove the key from the cache bank with all the key content. If no key is
    specified remove the entire bank with all keys and sub-banks inside.

    CLI Examples:

    .. code-block:: bash

        salt-run cache.flush cloud/active/ec2/myec2 cachedir=/var/cache/salt/
        salt-run cache.flush cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
    NrRrS)rr
rTrUrV�flushr[rrrr\�s�r\)r)Nr)NrFFFN)NrN)N)NN)&�__doc__rO�loggingrIZ
salt.cacher
Zsalt.configZsalt.fileserver.gitfsZsalt.payloadZsalt.pillar.git_pillarZsalt.runners.winrepoZsalt.utils.argsZsalt.utils.gitfsZsalt.utils.masterZsalt.exceptionsrZsalt.fileserverrr>�	getLogger�__name__�logZ__func_alias__rrrr!rrrrr&rErFrWrrZr\rrrr�<module>sN
�

!

�






m
*