File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__pycache__/svn_pillar.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlmZ ddlmZ dZzddl Z dZe � � ZW n ey1 Y nw e� e�ZdZdd � ZG d d� d�Zdd d�Zdd� ZdS )a� Clone a remote SVN repository and use the filesystem as a Pillar source This external Pillar source can be configured in the master config file like so: .. code-block:: yaml ext_pillar: - svn: trunk svn://svnserver/repo root=subdirectory The `root=` parameter is optional and used to set the subdirectory from where to look for Pillar files (such as ``top.sls``). .. versionchanged:: 2014.7.0 The optional ``root`` parameter will be added. Note that this is not the same thing as configuring pillar data using the :conf_master:`pillar_roots` parameter. The branch referenced in the :conf_master:`ext_pillar` entry above (``master``), would evaluate to the ``base`` environment, so this branch needs to contain a ``top.sls`` with a ``base`` section in it, like this: .. code-block:: yaml base: '*': - foo To use other environments from the same SVN repo as svn_pillar sources, just add additional lines, like so: .. code-block:: yaml ext_pillar: - svn: trunk svn://svnserver/repo - svn: dev svn://svnserver/repo In this case, the ``dev`` branch would need its own ``top.sls`` with a ``dev`` section in it, like this: .. code-block:: yaml dev: '*': - bar � N)�deepcopy)�PillarFT�svnc C sB dd� t �dg �D �} tdd� | D ��sdS tst�d� dS tS )Nc S s g | ]}|�qS � r ��.0�xr r �J/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/svn_pillar.py� <listcomp>J s z__virtual__.<locals>.<listcomp>� ext_pillarc S s g | ]}d |v �qS )r r r r r r r K s Fz]SVN-based ext_pillar is enabled in configuration but could not be loaded, is pysvn installed?)�__opts__�get�any�HAS_SVN�log�error�__virtualname__)Zext_pillar_sourcesr r r �__virtual__I s �r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) � SvnPillarz8 Deal with the remote SVN repository for Pillar c C s� t �|��� }tj�|d d|�}|| _|| _|| _|| _ tj� |�sIt�|� t� d� z t�||� W dS tjyH t�d||� Y dS w dS )z7 Try to initialize the SVN repo object ZcachedirZpillar_svnfsz-Checking out fileserver for svn_pillar modulez%Failed to initialize svn_pillar %s %sN)�hashlib�md5� hexdigest�os�path�join�branch�root�repo_dir� repo_location�isdir�makedirsr �debug�CLIENTZcheckout�pysvn�ClientErrorr )�selfr r r �optsZ repo_hashr r r r �__init__[ s"