File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__pycache__/gitfs.cpython-310.pyc
Back
o ;j. � @ s� d Z ddlZddlZddlmZ dZdZdZdZ e� e�ZdZ d Zd-dd�Zd d� Zdd� Zd.dd�Zd/dd�Zd/dd�Zdd� Zd0dd�Zd1dd�Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� ZdS )2a Git Fileserver Backend With this backend, branches and tags in a remote git repository are exposed to salt as different environments. To enable, add ``gitfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - gitfs .. note:: ``git`` also works here. Prior to the 2018.3.0 release, *only* ``git`` would work. The Git fileserver backend supports both pygit2_ and GitPython_, to provide the Python interface to git. If both are present, the order of preference for which one will be chosen is the same as the order in which they were listed: pygit2, then GitPython. An optional master config parameter (:conf_master:`gitfs_provider`) can be used to specify which provider should be used, in the event that compatible versions of both pygit2_ and GitPython_ are installed. More detailed information on how to use GitFS can be found in the :ref:`GitFS Walkthrough <tutorial-gitfs>`. .. note:: Minimum requirements To use pygit2_ for GitFS requires a minimum pygit2_ version of 0.20.3. pygit2_ 0.20.3 requires libgit2_ 0.20.0. pygit2_ and libgit2_ are developed alongside one another, so it is recommended to keep them both at the same major release to avoid unexpected behavior. For example, pygit2_ 0.21.x requires libgit2_ 0.21.x, pygit2_ 0.22.x will require libgit2_ 0.22.x, etc. To use GitPython_ for GitFS requires a minimum GitPython version of 0.3.0, as well as the git CLI utility. Instructions for installing GitPython can be found :ref:`here <gitfs-dependencies>`. To clear stale refs the git CLI utility must also be installed. .. _pygit2: https://github.com/libgit2/pygit2 .. _libgit2: https://libgit2.github.com/ .. _GitPython: https://github.com/gitpython-developers/GitPython � N)�FileserverConfigError)�base�fallbackZ mountpoint�rootZ ssl_verifyZsaltenv_whitelistZsaltenv_blacklistZrefspecsZdisable_saltenv_mappingZ ref_typesZupdate_interval)Zall_saltenvs�nameZsaltenv)Zpygit2)�user�passwordZpubkeyZprivkeyZ passphraseZ insecure_auth�gitfs)�gitTc C s t jjjttd tt| d�S )NZ gitfs_remotes)Zper_remote_overridesZper_remote_only�init_remotes)�salt�utilsr ZGitFS�__opts__�PER_REMOTE_OVERRIDES�PER_REMOTE_ONLY�r � r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/gitfs.py�_gitfsR s �r c C s6 t td vrdS ztdd� t W S ty Y dS w )zz Only load if the desired provider module is present and gitfs is enabled properly in the master config file. Zfileserver_backendFr )�__virtualname__r r r r r r r �__virtual__\ s �r c C s t dd��� S )z& Completely clear gitfs cache Fr )r �clear_cacher r r r r m � r �updatec C s t � j| |d�S )z Clear update.lk ��remoteZ lock_type)r � clear_lockr r r r r t � r c C � t � j| d�S )z� Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked. �r )r �lockr r r r r { s r c C s t � �| � dS )z1 Execute a git fetch on all of the repos N)r r )Zremotesr r r r � r c C s t � �� S )zA Returns the update intervals for each configured remote )r �update_intervalsr r r r r! � s r! Fc C r )z@ Return a list of refs that can be used as environments �Zignore_cache)r �envsr"