%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/pillar/ |
Current File : //lib/python2.7/site-packages/salt/pillar/hg_pillar.pyo |
� ���^c @@ s d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z y d d l Z Wn e k r� d Z n Xd Z e j e � Z i Z d � Z d � Z d d d � Z d � Z d e f d � � YZ d S( 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 ( t absolute_importt print_functiont unicode_literalsN( t sixu hgc C@ si g t j d g � D] } | ^ q } t g | D] } d | k ^ q/ � sN t St se t j d � t St S( u* Only load if hglib is available. u ext_pillaru hgu hglib not present( t __opts__t gett anyt Falset hglibt logt errort __virtualname__( t xt ext_pillar_sources( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt __virtual__0 s %% c C@ s d S( 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__= s u defaultc C@ s� t | � � } | j | � Wd QX| d k r4 d n | } | rg t j j t j j | j | � � } n | j } t j t � } | g | d | <t j j | t | | � } | j d t � S( u. Extract pillar from an hg repository Nu defaultu baseu pillar_rootst ext( t Repot updatet ost patht normpatht joint working_dirt copyt deepcopyR t saltt pillart Pillart __grains__t compile_pillarR ( t minion_idR t repot brancht roott envnameR t optst pil( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyt ext_pillarE s ' c C@ s# t | � � } | j � Wd QXd S( u- Execute an hg pull on all the repos N( R t pull( t repo_uriR ( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyR W s R c B@ sG e Z d Z d � Z d � Z d d � Z d � Z d � Z d � Z RS( u? Deal with remote hg (mercurial) repository for Pillar c C@ s� | | _ t j j t d d � } t t t j d d � � } t j r[ | | � j � } n! | t j j j | � � j � } t j j | | � | _ t j j | j � s� t j | | j � | _ | j j � n t j | j � | _ d S( u8 Initialize a hg repo (or open it if it already exists) u cachediru hg_pillaru hash_typeu md5N( R( R R R R t getattrt hashlibR R t PY2t hexdigestR t utilst stringutilst to_bytesR t isdirR t cloneR t open( t selfR( t cachedirt hash_typet repo_hash( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/hg_pillar.pyR d s !c C@ s t j d � | j j � d S( Nu- Updating hg repo from hg_pillar module (pull)( R t debugR R'