%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/nfs3.pyc

�
���^c@@s�dZddlmZmZmZddlZddlmZddlZ	ddl
Z	ddlZ	eje
�Zd�Zdd�Zddd�Zddddd	�Zd
�Zd�ZdS(u$
Module for managing NFS version 3.
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@s#tjjjd�stdfStS(u)
    Only work on POSIX-like systems
    u	showmountuRThe nfs3 execution module failed to load: the showmount binary is not in the path.(tsalttutilstpathtwhichtFalsetTrue(((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt__virtual__s
u/etc/exportsc
C@s�i}tjjj|d��k}xatjjj|j��j�D]>}|sUqCn|jd�rjqCn|j	�}|d|kr�g||d<ng}x�|dD]�}|jd�r�|j
|�q�n|j	d�}|djdd�|d<|d}t|t
j�s$td	��n|dj	d
�}	||dj
i|d6|	d6�q�Wx |D]}
||d||
<qeWqCWWd
QX|S(up
    List configured exports

    CLI Example:

    .. code-block:: bash

        salt '*' nfs.list_exports
    uru#iiu/u(u)uuhosts argument must be a stringu,uhostsuoptionsN(RRtfilestfopentstringutilst
to_unicodetreadt
splitlinest
startswithtsplittappendtreplacet
isinstanceRtstring_typest	TypeError(texportstrettefltlinetcompst	newsharestpermt	permcompsthoststoptionstshare((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pytlist_exportss2
(

'
 cC@s$t|�}||=t||�|S(uv
    Remove an export

    CLI Example:

    .. code-block:: bash

        salt '*' nfs.del_export /media/storage
    (R#t_write_exports(RRtedict((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt
del_exportEs

cC@s�|dkrg}nt|tj�s6td��nt|�}||kr[g||<ni|d6|d6}||j|�t||�|S(u�
    Add an export

    CLI Example:

    .. code-block:: bash

        salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw']
    uhosts argument must be a stringuhostsuoptionsN(tNoneRRRRR#RR$(RRR R!R%tnew((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt
add_exportUs
	

c
C@s�tjjj|d���}x�|D]y}tjjj|�}xE||D]9}|d}dj|d�}|dj||�7}qHW|jdj|��q"WWdQXdS(uS
    Write an exports file to disk

    If multiple shares were initially configured per line, like:

        /media/storage /media/data *(ro,sync,no_subtree_check)

    ...then they will be saved to disk with only one share per line:

        /media/storage *(ro,sync,no_subtree_check)
        /media/data *(ro,sync,no_subtree_check)
    uwuhostsu,uoptionsu	 {0}({1})u{0}
N(	RRRRR
tto_strtjointformattwrite(RR%tefhtexportRtpermsR R!((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pyR$ns


cC@sPi}d}td|�}|d|d<|d|d<|ddk|d<|S(u�
    Trigger a reload of the exports file to apply changes

    CLI Example:

    .. code-block:: bash

        salt '*' nfs3.reload_exports
    uexportfs -rucmd.run_allustdoutustderruuresult(t__salt__(Rtcommandtoutput((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pytreload_exports�s
(t__doc__t
__future__RRRtloggingtsalt.extRtsalt.utils.filesRtsalt.utils.pathtsalt.utils.stringutilst	getLoggert__name__tlogR
R#R'R&R)R$R4(((s5/usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt<module>s		)	

Zerion Mini Shell 1.0