%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/states/ |
Current File : //usr/lib/python2.7/site-packages/salt/states/nfs_export.pyo |
� ���^c @@ s\ d Z d d l m Z m Z m Z d d l Z d � Z d d d d d � Z d d � Z d S( u� Management of NFS exports =============================================== .. versionadded:: 2018.3.0 To ensure an NFS export exists: .. code-block:: yaml add_simple_export: nfs_export.present: - name: '/srv/nfs' - hosts: '10.0.2.0/24' - options: - 'rw' This creates the following in /etc/exports: .. code-block:: bash /srv/nfs 10.0.2.0/24(rw) For more complex exports with multiple groups of hosts, use 'clients': .. code-block:: yaml add_complex_export: nfs_export.present: - name: '/srv/nfs' - clients: # First export, same as simple one above - hosts: '10.0.2.0/24' options: - 'rw' # Second export - hosts: '*.example.com' options: - 'ro' - 'subtree_check' This creates the following in /etc/exports: .. code-block:: bash /srv/nfs 10.0.2.0/24(rw) 192.168.0.0/24,172.19.0.0/16(ro,subtree_check) Any export of the given path will be modified to match the one specified. To ensure an NFS export is absent: .. code-block:: yaml delete_export: nfs_export.absent: - name: '/srv/nfs' i ( t absolute_importt print_functiont unicode_literalsNc C@ s/ d } t j j j | � r% t | � St d f S( u, Only work with nfs tools installed u exportfsuS The nfs_exports state module failed to load: the exportfs binary is not in the path( t saltt utilst patht whicht boolt False( t cmd( ( s: /usr/lib/python2.7/site-packages/salt/states/nfs_export.pyt __virtual__@ s u /etc/exportsc C@ s� | } i | d 6i d 6d d 6d d 6} | sf | sL t | d <d | d <| Si | d 6| d 6g } n t d | � } | | k r| | | k r� t | d <d j | � | d <| S| | d d <| | | d d <t d r� d | d <d j | � | d <| St d | | � nG d | d d <| | d d <t d rYd | d <d j | � | d <| St d } x) | D]! } | | | | d | d � qjW| | d d <t d � } | d | d <| d | d <| S( u� Ensure that the named export is present with the given options name The export path to configure clients A list of hosts and the options applied to them. This option may not be used in combination with the 'hosts' or 'options' shortcuts. .. code-block:: yaml - clients: # First export - hosts: '10.0.2.0/24' options: - 'rw' # Second export - hosts: '*.example.com' options: - 'ro' - 'subtree_check' hosts A string matching a number of hosts, for example: .. code-block:: yaml hosts: '10.0.2.123' hosts: '10.0.2.0/24' hosts: 'minion1.example.com' hosts: '*.example.com' hosts: '*' options A list of NFS options, for example: .. code-block:: yaml options: - 'rw' - 'subtree_check' u nameu changesu resultu u commentu+ Either 'clients' or 'hosts' must be definedu hostsu optionsu nfs3.list_exportsu Export {0} already configuredu newu oldu testu Export {0} would be changedu nfs3.del_exportu Export {0} would be addedu nfs3.add_exportu nfs3.reload_exportsu stderrN( t NoneR t __salt__t Truet formatt __opts__( t namet clientst hostst optionst exportsR t rett oldt add_exportt expt try_reload( ( s: /usr/lib/python2.7/site-packages/salt/states/nfs_export.pyt presentO sL 6 c C@ s | } i | d 6i d 6d d 6d d 6} t d | � } | | k r� t d r� d j | � | d <| | | d | <d | d <| St d | | � t d � } | d s� | d | d <n d j | � | d <| d | d <| | | d | <n d j | � | d <t | d <| S( u` Ensure that the named path is not exported name The export path to remove u nameu changesu resultu u commentu nfs3.list_exportsu testu Export {0} would be removedu nfs3.del_exportu nfs3.reload_exportsu stderru Export {0} removedu Export {0} already absentN( R R R R R ( R R R R R R ( ( s: /usr/lib/python2.7/site-packages/salt/states/nfs_export.pyt absent� s, ( t __doc__t __future__R R R t salt.utils.pathR R R R R ( ( ( s: /usr/lib/python2.7/site-packages/salt/states/nfs_export.pyt <module>; s d