%PDF- %PDF-
| Direktori : /lib/python2.7/site-packages/salt/modules/ |
| Current File : //lib/python2.7/site-packages/salt/modules/nfs3.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l m Z d d l Z d d l
Z d d l Z e j e
� Z d � Z d d � Z d d d � Z d d d d d � Z d
� Z d � Z d S( u$
Module for managing NFS version 3.
i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s# t j j j d � s t d f St S( u)
Only work on POSIX-like systems
u showmountuR The nfs3 execution module failed to load: the showmount binary is not in the path.( t saltt utilst patht whicht Falset True( ( ( s5 /usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt __virtual__ s
u /etc/exportsc
C@ s� i } t j j j | d � �k} xat j j j | j � � j � D]>} | sU qC n | j d � rj qC n | j � } | d | k r� g | | d <n g } x� | d D]� } | j d � r� | j
| � q� n | j d � } | d j d d � | d <| d } t | t
j � s$t d � � n | d j d
� } | | d j
i | d 6| d 6� q� Wx | D] }
| | d | |
<qeWqC WWd
QX| S( up
List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports
u ru #i i u /u (u )u u hosts argument must be a stringu ,u hostsu optionsN( R R t filest fopent stringutilst
to_unicodet readt
splitlinest
startswitht splitt appendt replacet
isinstanceR t string_typest TypeError( t exportst rett eflt linet compst newsharest permt permcompst hostst optionst share( ( s5 /usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt list_exports s2
(
'
c C@ s$ t | � } | | =t | | � | S( uv
Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage
( R# t _write_exports( R R t edict( ( s5 /usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt
del_exportE s
c C@ s� | d k r g } n t | t j � s6 t d � � n t | � } | | k r[ g | | <n i | d 6| d 6} | | 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']
u hosts argument must be a stringu hostsu optionsN( t NoneR R R R R# R R$ ( R R R R! R% t new( ( s5 /usr/lib/python2.7/site-packages/salt/modules/nfs3.pyt
add_exportU s
c
C@ s� t j j j | d � �� } x� | D]y } t j j j | � } xE | | D]9 } | d } d j | d � } | d j | | � 7} qH W| j d j | � � q"