File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/winrepo.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl ZddlmZm Z ddlmZ ddlmZ ejj�� rRejj�ee� �Zejj�ee� �Ze�e�ZdZdd� Zdd d�Zdd � 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_reposZwinrepoc C s t jj�� rtS dS )z5 Set the winrepo module if the OS is Windows )Fz"This module only works on Windows.)�salt�utils�platform� is_windows�__virtualname__� r r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/winrepo.py�__virtual__% s r �basec C s\ t d }g }|�tjj� |�ddg� |�| � |�|dd � �d��d�� tj � |�S )N�winrepo_source_dirZminion�files� �/)�__opts__�appendr ZsyspathsZ CACHE_DIR�extend�strip�split�os�sep�join)�saltenvr �dirsr r r �_get_local_repo_dir. s r c C s t tdd�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)�_genrepor r r r r r 8 s r Fc C s$ t jj�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/ Args: clean (:obj:`bool`, optional): Clean repo cachedirs which are not configured under :conf_minion:`winrepo_remotes`. Default is ``False``. .. 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)r r �path�whichr �_update_git_reposr )r! r r r r E s (�r c C s t j�| �r | }n7t|�}|�d�}| �d�}|�|� t j�|�� d�}t j�|�s@t j�|�� d�}t j�|�s@d| � d�S tj � tt�}i }ztj �||td td td �}W |S ty� } zt�d |� t�d|� d|� �|d <