%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
mZddlmZidd6dd6dd	6dd
6dd6Zejd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS(u,
Manage the information in the aliases file
i(tabsolute_importtprint_functiontunicode_literalsN(tSaltInvocationError(tsixutxturm_aliasu
has_targetu
get_targetu
set_targetuyamlulist_aliasesu"([^:#]*)\s*:?\s*([^#]*?)(\s+#.*|$)cC@stjjtdd��S(u9
    Return the path to the appropriate aliases file
    u
config.optionualiases.file(tostpathtrealpatht__salt__(((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt__get_aliases_filename!sc	C@s�t�}g}tjj|�s%|Stjjj|d��t}xj|D]b}tjjj	|�}t
j|�}|r�|j|j
��qG|jdd|j�f�qGWWdQX|S(u�
    Parse the aliases file, and return a list of line components:

    [
      (alias1, target1, comment1),
      (alias2, target2, comment2),
    ]
    urN(R	RRtisfiletsalttutilstfilestfopentstringutilst
to_unicodet
__ALIAS_REtmatchtappendtgroupstNonetstrip(tafntrettifiletlineR((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt__parse_aliases(s		
&c
C@s�t�}tjj|�}tjd|dt�}tjdt�s�tjj	|�r�tj
|�}tj|jt
j
|j��tj|j|j|j�q�tj|jd�tj|jdd�nx�|D]�\}}}t|t�rdj|�}n|sd}n|r:|r:dj|||�}nd	j|�}tjrd|jt�}n|j|�q�W|j�tj|j|�tjjjd
�}	|	dk	r�t!d|	�nt"S(
um
    Write a new copy of the aliases file.  Lines is a list of lines
    as returned by __parse_aliases.
    tdirtdeleteuintegration.testi�iu, uu{0}: {1}{2}
u{0}
u
newaliasesucmd.runN(#R	RRtdirnamettempfiletNamedTemporaryFiletFalset__opts__tgetR
tstattchmodtnametS_IMODEtst_modetchowntst_uidtst_gidt
isinstancetlisttjointformatRtPY3tencodet__salt_system_encoding__twritetclosetrenameRRtwhichRRtTrue(
tlinesRtadirtouttafn_stt
line_aliastline_targettline_commentt
write_linet
newaliases((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt__write_aliases_file@s8			
cC@std�t�D��}|S(u�
    Return the aliases found in the aliases file in this format::

        {'alias': 'target'}

    CLI Example:

    .. code-block:: bash

        salt '*' aliases.list_aliases
    cs@s*|] \}}}|r||fVqdS(N((t.0taliasttargettcomment((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pys	<genexpr>ys(tdictR(R((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pytlist_aliasesmscC@s!t�}||kr||SdS(u�
    Return the target associated with an alias

    CLI Example:

    .. code-block:: bash

        salt '*' aliases.get_target alias
    u(RG(RCtaliases((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt
get_target}s
	cC@sc|dkrtd��nt�}||kr4tSt|t�rUdj|�}n|||kS(u�
    Return true if the alias/target is set

    CLI Example:

    .. code-block:: bash

        salt '*' aliases.has_target alias target
    uu!target can not be an empty stringu, (RRGR!R,R-R.(RCRDRH((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt
has_target�s
	cC@s�|dkrtd��n|dkr6td��nt|�|krLtSt�}g}t}xa|D]Y\}}}||kr�|s�|j|||f�t}q�qh|j|||f�qhW|s�|j||df�nt|�tS(u
    Set the entry in the aliases file for the given alias, this will overwrite
    any previous entry for the given alias or create a new one if it does not
    exist.

    CLI Example:

    .. code-block:: bash

        salt '*' aliases.set_target alias target
    uu alias can not be an empty stringu!target can not be an empty string(RRIR7RR!RRA(RCRDR8R:tovrR<R=R>((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt
set_target�s&
	
cC@slt|�stSt�}g}x<|D]4\}}}||kr&|j|||f�q&q&Wt|�tS(u�
    Remove an entry from the aliases file

    CLI Example:

    .. code-block:: bash

        salt '*' aliases.rm_alias alias
    (RIR7RRRA(RCR8R:R<R=R>((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pytrm_alias�s
	
(t__doc__t
__future__RRRRtreR$Rtsalt.utils.filesRtsalt.utils.pathtsalt.utils.stringutilstsalt.exceptionsRtsalt.extRt
__outputter__tcompileRR	RRARGRIRJRLRM(((s8/usr/lib/python2.7/site-packages/salt/modules/aliases.pyt<module>s2
			-				'

Zerion Mini Shell 1.0