%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/pillar/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/pillar/hg_pillar.pyo

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZddl	Z
ddlZ
ddlm
Z
yddlZWnek
r�dZnXdZeje�ZiZd�Zd�Zddd	�Zd
�Zdefd��YZdS(
u�
Use remote Mercurial repository as a Pillar source.

.. versionadded:: 2015.8.0

The module depends on the ``hglib`` python module being available.
This is the same requirement as for hgfs\_ so should not pose any extra
hurdles.

This external Pillar source can be configured in the master config file as such:

.. code-block:: yaml

   ext_pillar:
     - hg: ssh://hg@example.co/user/repo
i(tabsolute_importtprint_functiontunicode_literalsN(tsixuhgcC@sigtjdg�D]}|^q}tg|D]}d|k^q/�sNtStsetjd�tStS(u*
    Only load if hglib is available.
    u
ext_pillaruhguhglib not present(t__opts__tgettanytFalsethglibtlogterrort__virtualname__(txtext_pillar_sources((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt__virtual__0s%%
cC@sdS(uX
    Initialise

    This is called every time a minion calls this external pillar.
    N((R((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt__init__=sudefaultc	C@s�t|��}|j|�WdQX|dkr4dn|}|rgtjjtjj|j|��}n	|j}tjt	�}|g|d|<t
jj|t
||�}|jdt�S(u.
    Extract pillar from an hg repository
    Nudefaultubaseupillar_rootstext(tRepotupdatetostpathtnormpathtjointworking_dirtcopytdeepcopyRtsalttpillartPillart
__grains__tcompile_pillarR(	t	minion_idRtrepotbranchtroottenvnameRtoptstpil((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt
ext_pillarEs'	cC@s#t|��}|j�WdQXdS(u-
    Execute an hg pull on all the repos
    N(Rtpull(trepo_uriR ((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyRWsRcB@sGeZdZd�Zd�Zdd�Zd�Zd�Zd�ZRS(u?
    Deal with remote hg (mercurial) repository for Pillar
    cC@s�||_tjjtdd�}tttjdd��}tj	r[||�j
�}n!|tjj
j|��j
�}tjj||�|_tjj|j�s�tj||j�|_|jj�ntj|j�|_dS(u8 Initialize a hg repo (or open it if it already exists) ucachediru	hg_pillaru	hash_typeumd5N(R(RRRRtgetattrthashlibRRtPY2t	hexdigestRtutilststringutilstto_bytesRtisdirRtcloneR topen(tselfR(tcachedirt	hash_typet	repo_hash((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyRds		!cC@stjd�|jj�dS(Nu-Updating hg repo from hg_pillar module (pull)(R	tdebugR R'(R3((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyR'ts
udefaultcC@sAtjd�|jj�tjd�|jj|dt�dS(uN
        Ensure we are using the latest revision in the hg repository
        u-Updating hg repo from hg_pillar module (pull)u/Updating hg repo from hg_pillar module (update)tcleanN(R	R7R R'RtTrue(R3R!((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyRxs


cC@s|jj�dS(u2
        Cleanup mercurial command server
        N(R tclose(R3((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyR:�scC@s|S(N((R3((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt	__enter__�scC@s|j�dS(N(R:(R3texc_typet	exc_valuet	traceback((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt__exit__�s(	t__name__t
__module__t__doc__RR'RR:R;R?(((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyR_s					(RBt
__future__RRRRR*tloggingRtsalt.pillarRtsalt.utils.stringutilstsalt.extRRtImportErrortNoneRt	getLoggerR@R	RRRR&RtobjectR(((s9/usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt<module>s(

	
		

Zerion Mini Shell 1.0