%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZy ddlmZmZeZWne	k
rUe
ZnXer�ddlZddlm
Z
ddlZddlZdefd��YZndS(u+
Functions for working with Mako templates
i(tabsolute_importtunicode_literals(tTemplateCollectiontTemplateLookupN(turlparsetSaltMakoTemplateLookupcB@sDeZdZded�Zd�Zd�Zdd�Zd�Z	RS(u
        Look up Mako template files using file:// or salt:// URLs with <%include/>
        or <%namespace/>.

        (1) Look up mako template files on local file system via files://... URL.
            Make sure mako template file is present locally on minion beforehand.

          Examples:
            <%include   file="file:///etc/salt/lib/templates/sls-parts.mako"/>
            <%namespace file="file:///etc/salt/lib/templates/utils.mako" import="helper"/>

        (2) Look up mako template files on Salt master via salt://... URL.
            If URL is a relative  path (without an URL scheme) then assume it's relative
            to the directory of the salt file that's doing the lookup. If URL is an absolute
            path then it's treated as if it has been prefixed with salt://.

           Examples::
             <%include   file="templates/sls-parts.mako"/>
             <%include   file="salt://lib/templates/sls-parts.mako"/>
             <%include   file="/lib/templates/sls-parts.mako"/>                 ##-- treated as salt://

             <%namespace file="templates/utils.mako"/>
             <%namespace file="salt://lib/templates/utils.mako" import="helper"/>
             <%namespace file="/lib/templates/utils.mako" import="helper"/>     ##-- treated as salt://

        ubasecC@sC||_||_d|_||_tdd�|_i|_dS(Ntdirectoriesu/(toptstsaltenvtNonet_file_clienttpillar_rendRtlookuptcache(tselfRRR((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyt__init__4s				cC@s1|js*tjj|j|j�|_n|jS(u6
            Setup and return file_client
            (R
tsaltt
fileclienttget_file_clientRR(R((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pytfile_client<s		cC@sSt|�j}|dkr|S|r@tdj||���n|jj||�S(Nusaltufileu"Unsupported URL scheme({0}) in {1}(usaltufile(Rtschemet
ValueErrortformatRt
adjust_uri(RturitfilenameR((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyREscC@s�|jd�r$d}d}|}n�d}|jddkrT|jd|j}n%tjj|jdd|j�g}|j|�r�|ntjjj	|�}|j
|�td	|�|_|jj
|t|��S(
Nufile://u/usalt://ufile_clientulocalu
file_rootsucachedirufilesR(t
startswithRRtostpathtjoinRtutilsturltcreatet
cache_fileRRtget_templatetlen(RRt
relativetotprotot
searchpathtsalt_uri((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyR"Qs	*
cC@s>||jkr:|j�j|dt|j�|j|<ndS(Nu(R
Rtget_filetTrueR(Rtfpath((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyR!ds
N(
t__name__t
__module__t__doc__tFalseRRRR	R"R!(((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyRs			(R-t
__future__RRtmako.lookupRRR)tHAS_MAKOtImportErrorR.Rtsalt.ext.six.moves.urllib.parseRtsalt.fileclientRtsalt.utils.urlR(((s3/usr/lib/python2.7/site-packages/salt/utils/mako.pyt<module>s




Zerion Mini Shell 1.0