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

�N�g�%�@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlmZm
Z
e�e�ZdZejjjZdZdd�Zdd	d
�Zddd
�ZdS)z(
Runner to manage Windows software repo
�N)�CommandExecutionError�SaltRenderError)Z
ssl_verifyZrefspecs�fallback)�branchcCsttjjjtjjjf�S)N)�any�salt�utils�gitfsZGITPYTHON_VERSIONZPYGIT2_VERSION�r
r
�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/winrepo.py�_legacy_git"s�rTcCs:|durt}|d}|d}i}tj�|�st�|�tj�|t�}tj	j�
|�D]�\}}}|D]�}	|	�d�r�ztj�
tj�||	�||d|d|d�}
Wn#tyq}zt�dtj�||	��t�d	|�WYd}~q0d}~ww|
r�i}|
��D]c\}
}t�d
|
�|��D]T\}}t�d|
|�t|t�s�|
|
�|�|
|
t|�<t|t�s�d�tj�||	��}t�|�|r�z
t�d
|id�Wnty�t�d|�Ynwq�|
||d<q�qz|�di��|
�|�di��|�q0q)tj	j�tj�||�d��}|� tj	j!�"|��Wd�|S1�swY|S)aw
    Generate winrepo_cachefile based on sls files in the winrepo_dir

    opts
        Specify an alternate opts dict. Should not be used unless this function
        is imported into an execution module.

    fire_event : True
        Fire an event on failure. Only supported on the master.

    CLI Example:

    .. code-block:: bash

        salt-run winrepo.genrepo
    N�winrepo_dir�winrepo_cachefilez.slsZrendererZrenderer_blacklistZrenderer_whitelistzFailed to render %s.z
Error: %s.z'Compiling winrepo data for package '%s'z(Compiling winrepo data for %s version %szFailed to compile {}.�errorZprogressz^Attempted to fire the an event with the following error, but event firing is not supported: %sZ	full_name�repoZname_mapzw+b)#�__opts__�os�path�exists�makedirsr�loaderZrender�__salt__rZos_walk�endswith�templateZcompile_template�joinr�log�debug�items�
isinstance�str�pop�dict�formatZ
__jid_event__�
fire_event�	NameErrorr�
setdefault�update�filesZfopen�writeZmsgpack�dumps)�optsr#r
r�retZ	renderers�root�_r'�nameZconfig�excZrevmapZpkgnameZversions�versionZrepodata�msgrr
r
r�genrepo(s�

����
�
�
������1�
��r2FcCs.|durt}|d}|d}||f|d|dfg}i}|D]�\}}t�r�i}	|D]�}
d|
vr7|
�d�d}n|
}d}z
|
����\}}
WntyP|
}
Ynw|�d	d
�}tj�||d�}|r�t	dd
|
|d|ddd�}t
|t�r}td�
d�|����d|vr�tt|��}||}n1tj�|�}|jdd
|
|d|ddd�}t
|t�r�td�
d�|����d|vr�tt|��}||}|d|	|d<q)|�|	�qztjjj||ttt|d�}|��|r�|��|��Wn$t�y
}zd|��}tj |t!j"d�|WYd}~Sd}~ww|�|j#�q|S)a�
    Checkout git repos containing Windows Software Package Definitions

    opts
        Specify an alternate opts dict. Should not be used unless this function
        is imported into an execution module.

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

        .. 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

    CLI Examples:

    .. code-block:: bash

        salt-run winrepo.update_git_repos
        salt-run winrepo.update_git_repos clean=True
    Nr
�winrepo_remotesZwinrepo_remotes_ngZwinrepo_dir_ng�/����HEADz.git�r-zstate.singlez
git.latest�winrepoT)r.�revr�targetZforce_checkoutZforce_resetz$Failed up update winrepo remotes: {}�
r.z$Failed to update winrepo remotes: {}�result)Zper_remote_overridesZper_remote_onlyZglobal_onlyZ
cache_rootz"Failed to update winrepo_remotes: )Zexc_info_on_loglevel)$rr�split�strip�
ValueError�replacerrrrr�listrr"�next�iterrZminionZMasterMinionZ	functionsr&rr	ZWinRepo�PER_REMOTE_OVERRIDES�PER_REMOTE_ONLY�GLOBAL_ONLYZ
fetch_remotesZclear_old_remotesZcheckout�	Exceptionrr�logging�DEBUGZwinrepo_dirs)r*ZcleanZ
masterlessr
r3Zwinrepo_cfgr+Zremotes�base_dirZwinrepo_resultZremote_infoZ
targetnamer9Z
remote_urlZ	gittargetr<�keyZmminionr8r/r1r
r
r�update_git_repos|s����
	����
	���
��rL)NT)NFF)�__doc__rHrZsalt.loaderrZsalt.minionZ
salt.templateZsalt.utils.filesZsalt.utils.gitfsZsalt.utils.msgpackZsalt.utils.pathZsalt.exceptionsrr�	getLogger�__name__rrDrr	rErFrr2rLr
r
r
r�<module>s$


T