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/modules/__pycache__/winrepo.cpython-310.pyc
o

�N�g3�@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlmZm
Z
ddlmZddlmZejj��rRejj�ee��Zejj�ee��Ze�e�ZdZdd�Zdd
d�Zdd
�Zddd�Zddd�ZdS)z�
Module to manage Windows software repo on a Standalone Minion

``file_client: local`` must be set in the minion config file.

For documentation on Salt's Windows Repo feature, see :ref:`here
<windows-package-manager>`.
�N)�CommandExecutionError�SaltRenderError)�genrepo)�update_git_reposZwinrepocCstjj��rtSdS)z5
    Set the winrepo module if the OS is Windows
    )Fz"This module only works on Windows.)�salt�utils�platform�
is_windows�__virtualname__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/winrepo.py�__virtual__%sr
�basecCs\td}g}|�tjj�|�ddg�|�|�|�|dd��d��d��tj	�
|�S)N�winrepo_source_dirZminion�files��/)�__opts__�appendrZsyspathsZ	CACHE_DIR�extend�strip�split�os�sep�join)�saltenvr�dirsrrr�_get_local_repo_dir.s
rcCsttdd�S)z�
    Generate winrepo_cachefile based on sls files in the winrepo_dir

    CLI Example:

    .. code-block:: bash

        salt-call winrepo.genrepo
    F)�optsZ
fire_event)�_genreporrrrrr8s
rFcCs$tjj�d�std��tt|dd�S)a�
    Checkout git repos containing :ref:`Windows Software Package Definitions
    <windows-package-manager>`.

    .. important::
        This function requires `Git for Windows`_ to be installed in order to
        work. When installing, make sure to select an installation option which
        permits the git executable to be run from the Command Prompt.

    .. _`Git for Windows`: https://git-for-windows.github.io/

    clean : False
        Clean repo cachedirs which are not configured under
        :conf_minion:`winrepo_remotes`.

        .. note::
            This option only applies if either pygit2_ or GitPython_ is
            installed into Salt's bundled Python.

        .. warning::
            This argument should not be set to ``True`` if a mix of git and
            non-git repo definitions are being used, as it will result in the
            non-git repo definitions being removed.

        .. versionadded:: 2015.8.0

        .. _GitPython: https://github.com/gitpython-developers/GitPython
        .. _pygit2: https://github.com/libgit2/pygit2

    CLI Example:

    .. code-block:: bash

        salt-call winrepo.update_git_repos
    �gitz\Git for Windows is not installed, or not configured to be accessible from the Command PromptT)r�cleanZ
masterless)rr�path�whichr�_update_git_reposr)r!rrrrEs
$�rc
Cstj�|�r	|}n7t|�}|�d�}|�d�}|�|�tj�|��d�}tj�|�s@tj�|��d�}tj�|�s@d|�d�Stj	�
tt�}i}ztj
�||tdtdtd	�}W|Sty�}zt�d
|�t�d|�d|��|d
<|�|d<WYd}~|Sd}~ww)a
    .. versionadded:: 2015.8.0

    Display the rendered software definition from a specific sls file in the
    local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull
    the latest software definitions from the master.

    .. note::
        This function does not ask a master for an sls file to render. Instead
        it directly processes the file specified in `name`

    Args:
        name str: The name/path of the package you want to view. This can be the
        full path to a file on the minion file system or a file on the local
        minion cache.

        saltenv str: The default environment is ``base``

    Returns:
        dict: Returns a dictionary containing the rendered data structure

    .. note::
        To use a file from the minion cache start from the local winrepo root
        (``C:\salt\var\cache\salt\minion\files\base\win\repo-ng``). If you have
        ``.sls`` files organized in subdirectories you'll have to denote them
        with ``.``. For example, if you have a ``test`` directory in the winrepo
        root with a ``gvim.sls`` file inside, would target that file like so:
        ``test.gvim``. Directories can be targeted as well as long as they
        contain an ``init.sls`` inside. For example, if you have a ``node``
        directory with an ``init.sls`` inside, target that like so: ``node``.

    CLI Example:

    .. code-block:: bash

        salt '*' winrepo.show_sls gvim
        salt '*' winrepo.show_sls test.npp
        salt '*' winrepo.show_sls C:\test\gvim.sls
    �\�.z.slsz	\init.slszSoftware definition z
 not foundZrendererZrenderer_blacklistZrenderer_whitelistzFailed to compile %s.z
Error: %s.zFailed to compile �Message�ErrorN)rr"�existsrrrrrr�loaderZrenderrZ__salt__�templateZcompile_templater�log�debug)�namerZsls_fileZrepoZ
definitionZ	renderersZconfig�excrrr�show_slsqs<)


����r0)r)F) �__doc__�loggingrZsalt.loaderrZsalt.outputZ
salt.templateZsalt.utils.functoolsZsalt.utils.gitfsZsalt.utils.pathZsalt.utils.platformZsalt.exceptionsrrZsalt.runners.winreporrrr$rrr	�	functoolsZnamespaced_function�globals�	getLogger�__name__r,r
r
rr0rrrr�<module>s2	�

	


,