%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlm	Z	ddl
Z
ddlmZe
j
e�Zd�Zeddddeeed	eeeeeed
�Zedd�Zedeed�Zed
�ZdS(u�
Mounting of filesystems
=======================

Mount any type of mountable filesystem with the mounted function:

.. code-block:: yaml

    /mnt/sdb:
      mount.mounted:
        - device: /dev/sdb1
        - fstype: ext4
        - mkmnt: True
        - opts:
          - defaults

    /srv/bigdata:
      mount.mounted:
        - device: UUID=066e0200-2867-4ebe-b9e6-f30026ca2314
        - fstype: xfs
        - opts: nobootwait,noatime,nodiratime,nobarrier,logbufs=8
        - dump: 0
        - pass_num: 2
        - persist: True
        - mkmnt: True

    /var/lib/bigdata:
      mount.mounted:
        - device: /srv/bigdata
        - fstype: none
        - opts: bind
        - dump: 0
        - pass_num: 0
        - persist: True
        - mkmnt: True
i(tabsolute_importtprint_functiontunicode_literalsN(tstring_types(tsixcC@smt|jd��}|jd�dkr=t|�d}n|jd�dkrit|�dd}n|S(Nu
size_valueu	size_unitumiug(tinttgroup(t_re_sizetconverted_size((s5/usr/lib/python2.7/site-packages/salt/states/mount.pyt
_size_convert4sudefaultsu
/etc/fstabuautoc@K@s�i|d6id6td6dd6}t}|sFt|d<d|d<|S|sdt|d<d|d<|S|s�t|d<d|d<|S|d�kr�g}ntd	d�kr�|dkr�d
}ntd	d�kr�|dkr�d}q�nt|t�r|jd�}nt|t�r&|jd�}n|dksD|jd�}ng}tddt�}t	j
j|�}|jd�r�d|kr�||kr�|}||djd�r8xytr.||kr||d}t
t|||d||d��}||djd�Pnt	j
j|�}q�W|}q�||kr�t
t|||d||d��}||djd�n||d}q�t	j
j|�}n|j�jd�r�|jd�djd�j�}n�|j�jd�r�|jd�d}dj|�}tddj|��}|dd krgd!j|�|d<t|d<|Sx2|d"D]&}|jd#�d }|j|�qrW|d }n|}tjd$|�} | rtd%�tj| j��D��}!d&j|!�}"t	j
j|"�r|"}qntjd'|�}#|#rXd(|#j�krX|#jd(�}qXn||kr�
d||kr�g||d<n|	r�
|j||d�|jt	j
j|d ��d)||kr�||d)nd�}$d*||kr�||d*nd�}%d+||kr#||d+nd�}&|$rK|$|krK|j|$�n|%rm|%|krm|j|%�n|&r�|&|kr�|j|&�n|r<d,d-d.ddd/d0d1d2d3d4d5d6d7d8d9d:d;dd<d=d>d?g}'|
r�|'j|
�n|rt
t|'�t|�B�}'nd-dd@d0d6d>d8dAg}(|rO|(j|�nidBgdC6})|ru|)j|�nidDdE6dFdG6}*|r�|*j|�nx�|D]�}+|+|*kr�|*|+}+n|+jd�d },|,|(kr�|,}+ntjdH|+�}-|-r#t|-�}.dIj|.�}+n|d�krg|+jd�d dKkrgdLj|+jd�d�}+n|+jd�d |)j |g�kr�|+jd�d }+nidMdN6dOdP6}/|+jd�d |/krxt!|+jd��dkrx|+jd�d}0|+jd�d }1|0}2tjdQ|0�s^t|/|1|0�}3|3r^|1|3kr^|3|1}2q^n|1dtj"|2�}+n||j dg�}4xm|4D]e}5tjdH|5�}-|-r�t|-�}.dIj|.�}+|4j#|5�dIj|.�}5|4j|5�q�q�W|+||dkr�|+|4kr�|+|'kr�|+|)j |g�kr�|+|(kr�t$dRry	d�|d<dSj|+�|d<|S|d�ks�	|jdV�r$
dWdXj|+�|ddY<tdZ|�}6|6tkr�	td[||d\|d]|d^|�}7|7|d<q�
t|d<d_j||6�|d<|Snfd`dXj|+�|ddY<tda||d\|d]|d^|�}8|8|d<db|kr�
|j#db�nt}q�q�Wtdc|�}9d|9kr3g|9dD]}+|+|kr�
|+^q�
}:|:r9t$dRrd�|d<ddjdj%|:��|d<|S|d�ks1|jdV�r�dWdXj|+�|ddY<tdZ|�}6|6tkr�td[||d\|d]|d^|�}7|7|d<q't|d<d_j||6�|d<|Snfd`dXj|+�|ddY<tda||d\|d]|d^|�}8|8|d<db|kr'|j#db�nt}q9q<t}n||kr�
d�};xAt
|�D]3}<x*|D]"}tj|<|�rh|};PqhqhWq[W|;r�t|d<dedf|;|d<q�
t$dRr�d�|d<dgdh||d<q�
didj||ddY<||kr!
|ddYcdk|dl7<n|ddYcdmdnj%|�7<tdZ|do|
�}=tddt�}||kr�
dp|d<d�|d<|St}q�
dq|d<q�
n||kr�|	r�t$dRr)d�|d<t	j
j|�r�
drj|�|d<n/|rdsj|�|d<ndtj|�|d<|St	j
j|�r[|r[t|d<du|d<|Std[|||||do|
�}=tddt�}t}t|=t�r�|=|d<t|d<|S||kr�dv|d<t|ddw<q�q�t	j
j|�s�t$dRr?d�|d<|r)dxj|�|d<q�dyj|�|d<q�|rotdz|do|
�d{j|�|d<q�d|j|�|d<q�t$dRr�d�|d<d}j|�|d<q�d~j|�|d<n|r�d|krtd	d�kr�d�}qdtd	krd�}qnt$dRr�td	d�krKtd�|||||d�t�}=nltd	d�kr�td�|||||	|d�td�|�}=n.td�|||||||d�td�|�}=|=d�krd�|d<|=d�kr|	r�d�j|�}>qUd�j|�}>nR|=d�kr9|	r'd�j|�}>qUd�j|�}>nt|d<d�j||=�}>d|kr~d�j|d|>�|d<n
|>|d<|Sn�td	d�kr�td�|||||�}=n`td	d�kr�td�|||||	|d�|�}=n(td�|||||||d�|�}=|rLtd�||d\|d]|d�|�}?n|=d�krl|dcd�7<|S|=d�kr�d�|dd�<|dcd�7<|S|=d�kr�d�|dd�<|dcd�7<|S|=d�kr�t|d<|dcd�7<|Sn|S(�u�
    Verify that a device is mounted

    name
        The path to the location where the device is to be mounted

    device
        The device name, typically the device node, such as ``/dev/sdb1``
        or ``UUID=066e0200-2867-4ebe-b9e6-f30026ca2314`` or ``LABEL=DATA``

    fstype
        The filesystem type, this will be ``xfs``, ``ext2/3/4`` in the case of classic
        filesystems, ``fuse`` in the case of fuse mounts, and ``nfs`` in the case of nfs mounts

    mkmnt
        If the mount point is not present then the state will fail, set ``mkmnt: True``
        to create the mount point if it is otherwise not present

    opts
        A list object of options or a comma delimited list

    dump
        The dump value to be passed into the fstab, Default is ``0``

    pass_num
        The pass value to be passed into the fstab, Default is ``0``

    config
        Set an alternative location for the fstab, Default is ``/etc/fstab``

    persist
        Set if the mount should be saved in the fstab, Default is ``True``

    mount
        Set if the mount should be mounted immediately, Default is ``True``

    user
        The account used to execute the mount; this defaults to the user salt is
        running as on the minion

    match_on
        A name or list of fstab properties on which this state should be applied.
        Default is ``auto``, a special value indicating to guess based on fstype.
        In general, ``auto`` matches on name for recognized special devices and
        device otherwise.

    device_name_regex
        A list of device exact names or regular expressions which should
        not force a remount. For example, glusterfs may be mounted with a
        comma-separated list of servers in fstab, but the /proc/self/mountinfo
        will show only the first available server.

        .. code-block:: jinja

            {% set glusterfs_ip_list = ['10.0.0.1', '10.0.0.2', '10.0.0.3'] %}

            mount glusterfs volume:
              mount.mounted:
                - name: /mnt/glusterfs_mount_point
                - device: {{ glusterfs_ip_list|join(',') }}:/volume_name
                - fstype: glusterfs
                - opts: _netdev,rw,defaults,direct-io-mode=disable
                - mkmnt: True
                - persist: True
                - dump: 0
                - pass_num: 0
                - device_name_regex:
                  - ({{ glusterfs_ip_list|join('|') }}):/volume_name

        .. versionadded:: 2016.11.0

    extra_mount_invisible_options
        A list of extra options that are not visible through the
        ``/proc/self/mountinfo`` interface.

        If a option is not visible through this interface it will always remount
        the device. This option extends the builtin ``mount_invisible_options``
        list.

    extra_mount_invisible_keys
        A list of extra key options that are not visible through the
        ``/proc/self/mountinfo`` interface.

        If a key option is not visible through this interface it will always
        remount the device. This option extends the builtin
        ``mount_invisible_keys`` list.

        A good example for a key option is the password option::

            password=badsecret

    extra_mount_ignore_fs_keys
        A dict of filesystem options which should not force a remount. This will update
        the internal dictionary. The dict should look like this::

            {
                'ramfs': ['size']
            }

    extra_mount_translate_options
        A dict of mount options that gets translated when mounted. To prevent a remount
        add additional options to the default dictionary. This will update the internal
        dictionary. The dictionary should look like this::

            {
                'tcp': 'proto=tcp',
                'udp': 'proto=udp'
            }

    hidden_opts
        A list of mount options that will be ignored when considering a remount
        as part of the state application

        .. versionadded:: 2015.8.2
    unameuchangesuresultuucommentu"Must provide name to mount.mountedu$Must provide device to mount.mountedu$Must provide fstype to mount.mounteduosuMacOSuDarwinudefaultsunoownersuAIXu,u/umount.activetextendedubindudeviceuoptsu	superoptsuUUID=u=iu"uLABEL=ublkid -t LABEL={0}ucmd.run_allu{0}uretcodeiu%Unable to find device with label {0}.ustdoutu:u,^/dev/(?P<vg_name>[^/]+)/(?P<lv_name>[^/]+$)cs@s0|]&\}}|tjdd|�fVqdS(u-u--N(tretsub(t.0tktv((s5/usr/lib/python2.7/site-packages/salt/states/mount.pys	<genexpr>)su/dev/mapper/{vg_name}-{lv_name}u^\w+\#(?P<device_name>.+)udevice_nameu
alt_deviceudevice_uuidudevice_labelu_netdevuactimeoubgu
delay_connectudirect-io-modeuintruloopunointru
nobootwaitunofailupasswordu	reconnecturetryusoftuautouusersunonemptyutransform_symlinksuportubackup-volfile-serversucredentialsu
secretfileusizeuramfsu	proto=tcputcpu	proto=udpuudpu/size=(?P<size_value>[0-9]+)(?P<size_unit>k|m|g)u	size={0}kucifsuuseruusername={0}u	user.infouuidu
group.infougidu[0-9]+$utestu5Remount would be forced because options ({0}) changedunfsucvfsufuseu!Forced unmount and mount because uoptions ({0}) changeduumountumount.umountumount.mounttmkmnttfstypetoptsuUnable to unmount {0}: {1}.uForced remount because u
mount.remounturemountumount.read_mount_cacheu4Remount would be forced because options ({0})changeduAn umount will not be forced u*because device matched device_name_regex: u!An umount would have been forced u(because devices do not match.  Watched: uForced unmount because devices udon't match. Wanted: u (u)u, current: u, tuseruUnable to unmountuTarget was already mountedu{0} would be mountedu {0} would be created and mountedu+{0} does not exist and would not be createduMount directory is not presentuTarget was successfully mountedumountu%{0} would be created, but not mountedu;{0} does not exist and would neither be created nor mountedu
file.mkdiru{0} was created, not mountedu{0} not present and not mountedu{0} would not be mountedu{0} not mountedu
/etc/fstabu/etc/auto_saltu/etc/filesystemsumount.set_automasterttestumount.set_filesystemstmatch_onumount.set_fstabupresentunewuT{0} is mounted, but needs to be written to the fstab in order to be made persistent.uD{0} needs to be written to the fstab in order to be made persistent.uchangeu4{0} is mounted, but its fstab entry must be updated.u$The {0} fstab entry must be updated.u�Unable to detect fstab status for mount point {0} due to unexpected output '{1}' from call to mount.set_fstab. This is most likely a bug.u{0}. {1}umount.write_mount_cachet
mount_optsu$. Entry already exists in the fstab.upersistu. Added new entry to the fstab.uupdateu!. Updated the entry in the fstab.u
bad configu#. However, the fstab was not found.N(uMacOSuDarwin(uAIX(ucifs(unfsucvfs(unfsucvfs(uMacOSuDarwin(uMacOSuDarwin(uAIX(uMacOSuDarwin(uAIX(&tTruetFalsetNonet
__grains__t
isinstanceRtsplittrstript__salt__tostpathtrealpatht
startswithtlisttsettappendtdirnametuppertstriptlowertformatRtmatchtdictRt	iteritemst	groupdicttexistsRtextendtupdateR	tgettlent	text_typetremovet__opts__tjoin(@tnametdeviceRRRtdumptpass_numtconfigtpersisttmountRRtdevice_name_regextextra_mount_invisible_optionstextra_mount_invisible_keystextra_mount_ignore_fs_keystextra_mount_translate_optionsthidden_optstkwargstrettupdate_mount_cachetdevice_listtactivet	real_namet_devicet_real_devicetreal_devicet_labeltcmdtrestlinetdev_with_labelt	lvs_matchtdouble_dash_escapedt
mapper_devicet
fuse_matcht
alt_devicetuuid_devicetlabel_devicetmount_invisible_optionstmount_invisible_keystmount_ignore_fs_keystmount_translate_optionstoptt
keyval_optiont
size_matchRtname_id_optst_givenidt_paramt_idt_infot_active_superoptst_active_opttunmount_resulttmount_resulttremount_resulttmount_cachet_missingt_device_mismatch_is_ignoredtregextouttcommenttcache_result((s5/usr/lib/python2.7/site-packages/salt/states/mount.pytmounted=s�







			*	*%

	%$$$		



	%%

4



%

%



%

%
	



!

	



"






	



	





	

c

C@s:i|d6id6td6dd6}td�}td|�r�td|�}|jd	�s|d
jtjj|��}q�|}n|}||kr�dj|�|d<n�tdr�d*|d<d
j|�|d<nhtd|�td�}||kr"dj|�|d<|||d<ndj|�|d<t	|d<|r6d}dt
dkr�d}d|krvd}ntd|�}ntd|�}tdr	||kr|g|D]}||d^q�krd*|d<||krdj|�|d<qn|Sd|krD|d||krD|dddkrD|Sndt
dkrxd*}	t	|d<|dcd7<|Stdd|ddgd d |�}	|	d!kr�|S|	d"kr�d"|dd#<|dcd$7<|S|	d%kr	d&|dd#<|dcd'7<|S|	d(kr6t	|d<|dcd)7<|Sn|S(+u�
    Activates a swap device

    .. code-block:: yaml

        /root/swapfile:
          mount.swap

    .. note::
        ``swap`` does not currently support LABEL
    unameuchangesuresultuucommentumount.swapsufile.is_linku
file.readlinku/u/dev/{0}uSwap {0} already activeutestuSwap {0} is set to be activatedumount.swaponuSwap {0} activateduSwap {0} failed to activateudeviceuAIXuosudevu
/etc/fstabu/etc/filesystemsumount.filesystemsumount.fstabu<Swap {0} is set to be added to the fstab and to be activatedunoneufstypeuswapu.. swap not present in /etc/filesystems on AIX.umount.set_fstabudefaultsiupresentunewupersistu. Added new entry to the fstab.uchangeuupdateu!. Updated the entry in the fstab.u
bad configu#. However, the fstab was not found.N(RRR"R*RR tbasenameR6RRR(
R8R=R<RFton_treal_swap_devicetdevice_key_namet
fstab_datatitemRo((s5/usr/lib/python2.7/site-packages/salt/states/mount.pytswap�s�


	



	
3


	
c
K@s6i|d6id6td6dd6}t}|sFt|d<d|d<|Stddt�}||krrd	|d<n||krQtd
r�d(|d<dj|�|d<|S|r�td||d
|�}	t}ntd|d
|�}	t}t|	t�r|	|d<t|d<qQ|	tkr:d|d<t|dd<qQd|d<t|d<n|rjtd|�}
n|r2d}tdd)kr�|dkr�d}td|�}nNdtdkr�d}|dkr�d}ntd|�}ntd|�}||kr|dcd7<q2|rR||||krR|dcdj|�7<|Sntd
r�d(|d<d j||�|d<|Stdd*kr�td!|||�}	n?dtdkr�td"|||�}	ntd#|||�}	|	tk	rt|d<|dcd$7<q2|dcd%7<d&|dd'<n|S(+uj
    .. versionadded:: 0.17.0

    Verify that a device is not mounted

    name
        The path to the location where the device is to be unmounted from

    device
        The device to be unmounted.  This is optional because the device could
        be mounted in multiple places.

        .. versionadded:: 2015.5.0

    config
        Set an alternative location for the fstab, Default is ``/etc/fstab``

    persist
        Set if the mount should be purged from the fstab, Default is ``False``

    user
        The user to own the mount; this defaults to the user salt is
        running as on the minion
    unameuchangesuresultuucommentu$Must provide name to mount.unmountedumount.activeR
uTarget was already unmountedutestu,Mount point {0} is mounted but should not beumount.umountRu!Target was successfully unmounteduumountu.Execute set to False, Target was not unmountedumount.delete_mount_cacheudeviceuosuMacOSuDarwinu
/etc/fstabu/etc/auto_saltumount.automasteruAIXudevu/etc/filesystemsumount.filesystemsumount.fstabu. fstab entry not foundu&. fstab entry for device {0} not founduRMount point {0} is unmounted but needs to be purged from {1} to be made persistentumount.rm_automasterumount.rm_filesystemsumount.rm_fstabu. Failed to persist purgeu. Removed target from fstabupurgedupersistN(uMacOSuDarwin(uMacOSuDarwin(	RRRR6RR*RRR(
R8R9R<R=RRERFRGRIRoRqRvRw((s5/usr/lib/python2.7/site-packages/salt/states/mount.pyt	unmounted+s�







	




	


cK@s�i|d6id6td6dd6}|ddkr�td||d	t|d
|dd|�}|r|d
j|�|d<q�t|d<dj||�|d<ndj|d�|d<|S(ub
    The mounted watcher, called to invoke the watch command.

    .. note::
        This state exists to support special handling of the ``watch``
        :ref:`requisite <requisites>`. It should not be called directly.

        Parameters for this function should be set by the state being triggered.

    name
        The name of the mount point

    unameuchangesuresultuucommentusfunumountedu
mount.remountudeviceufstypeuoptsRu
{0} remountedu{0} failed to remount: {1}u'Watch not supported in {0} at this time(RRRR*(R8RRERFRo((s5/usr/lib/python2.7/site-packages/salt/states/mount.pyt	mod_watch�s

.
(t__doc__t
__future__RRRtos.pathRRtsalt.ext.sixRtloggingtsalt.extRt	getLoggert__name__tlogR	RRRRrRyRzR{(((s5/usr/lib/python2.7/site-packages/salt/states/mount.pyt<module>%s>	��|ds

Zerion Mini Shell 1.0