%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/pillar/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyc

�
���^c@@s�dZddlmZmZmZddlmZddlZddlZddl	Z	e
Zy"ddlZe
Zej�ZWnek
r�nXddlmZeje�ZdZd�Zdefd	��YZd
d�Zd�ZdS(
u�
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
i(tabsolute_importtprint_functiontunicode_literals(tdeepcopyN(tPillarusvncC@sigtjdg�D]}|^q}tg|D]}d|k^q/�sNtStsetjd�tStS(Nu
ext_pillarusvnu]SVN-based ext_pillar is enabled in configuration but could not be loaded, is pysvn installed?(t__opts__tgettanytFalsetHAS_SVNtlogterrort__virtualname__(txtext_pillar_sources((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt__virtual__Ls%%
t	SvnPillarcB@s)eZdZd�Zd�Zd�ZRS(u8
    Deal with the remote SVN repository for Pillar
    cC@s�tj|�j�}tjj|dd|�}||_||_||_||_	tjj
|�s�tj|�tj
d�ytj||�Wq�tjk
r�tjd||�q�XndS(u7
        Try to initialize the SVN repo object
        ucachedirupillar_svnfsu-Checking out fileserver for svn_pillar moduleu%Failed to initialize svn_pillar %s %sN(thashlibtmd5t	hexdigesttostpathtjointbranchtroottrepo_dirt
repo_locationtisdirtmakedirsR
tdebugtCLIENTtcheckouttpysvntClientErrorR(tselfRRRtoptst	repo_hashR((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt__init__\s				

cC@sTy!tjd�tj|j�Wn,tjk
rO}tjd|j|�nXdS(Nu)Updating fileserver for svn_pillar moduleu5Unable to fetch the latest changes from remote %s: %s(	R
RRtupdateRR R!RR(R"texc((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyR&ss
cC@s |j}|j}|j}|dks3|dkr�tjj|d|�}tjj|�svtjd|j	|�q�tjj
|�Sntjj|d||�}tjj|�r�tjj
|�Stjj|d||�}tjj|�rtjj
|�Stjd|j	||�|S(uS
        Returns the directory of the pillars (repo cache + branch + root)
        utrunkubaseuCould not find %s/trunk/%subranchesutagsu Could not find %s/branches/%s/%s(RRRRRRRR
RRtnormpath(R"RRRtworking_dir((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt
pillar_dir}s 			(t__name__t
__module__t__doc__R%R&R*(((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyRWs		
u=cC@s6|j|�}|d}|j|d�}||fS(utExtract key and value from key=val string.

    Example:
    >>> _extract_key_val('foo=bar')
    ('foo', 'bar')
    ii(tsplitR(tkvt	delimitertpiecestkeytval((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt_extract_key_val�s
cC@s^|j�j�}|d}|d}d}xt|dD]h}d}||kretjd||�nt||�\}	}
|	dkr�|
}q7tjd|	�q7Wt|||t�}|d	kr�d
p�|}|j�}tj	d||�tdj
|g�|gkriS|j�tt�}
|g|
d|<t
|
t||�}|jd
t�S(u7
    Execute a command and read the output as YAML
    iiuiu=u7Incorrectly formatted extra parameter. Missing '%s': %surootu Unrecognized extra parameter: %sutrunkubaseu[pillar_roots][%s] = %supillar_rootstext(tstripR.R
RR4twarningRRR*RRR&RRt
__grains__tcompile_pillarR(t	minion_idtpillartrepo_stringtoptionsRRRtextraopttDELIMR2R3tsvnpilR*R#tpil((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt
ext_pillar�s0

	
	
(R-t
__future__RRRtcopyRtloggingRRRR	R tTruetClientRtImportErrortsalt.pillarRt	getLoggerR+R
RRtobjectRR4RB(((s:/usr/lib/python2.7/site-packages/salt/pillar/svn_pillar.pyt<module>0s&
	=

Zerion Mini Shell 1.0