Mini Shell

Direktori : /lib/python3.6/site-packages/blivet/tasks/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/blivet/tasks/__pycache__/fsmount.cpython-36.pyc

3

{)c��@sFddlZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
lm
Z
Gdd�de
je	j�Z
Gd
d�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd �d e
�ZGd!d"�d"e�ZGd#d$�d$e
�ZGd%d&�d&e�ZdS)'�N�)�FSError)�flags)�util)�fslib�)�availability)�fstask)�taskcsveZdZdZdZdgZdZejZ	e
dd��Ze
dd��Ze
�fd	d
��Z
e
dd��Zd
d�Zdd�Zddd�Z�ZS)�FSMountz?An abstract class that represents filesystem mounting actions. zmount a filesystemZdefaultsNcsltjjtjjdtj�d��}tjj|�rhd|j�x2tj|�D]$\}}}t�fdd�|D��r@dSq@WdS)z? Is there a filesystem driver in the kernel modules directory. z/lib/modulesrz%s.koc3s|]}|j��VqdS)N)�
startswith)�.0�x)�modname��/usr/lib/python3.6/fsmount.py�	<genexpr>6sz&FSMount._has_driver.<locals>.<genexpr>TF)	�os�path�realpath�join�uname�isdir�
mount_type�walk�any)�selfZmodpathZ_rootZ_dirs�filesr)rr�_has_driver/s
zFSMount._has_drivercCs(|jtjkp&tjd|jftj�p&|jS)Nz/sbin/mount.%s)rrZkernel_filesystemsr�access�X_OKr)rrrr�
_can_mount:szFSMount._can_mountcs&tt|�j}|js"|jd|j�|S)Nz'mounting filesystem %s is not supported)�superr�_availability_errorsr!�appendr)r�errors)�	__class__rrr#@szFSMount._availability_errorscCs|jp|jjS)zv Mount type string to pass to mount command.

            :returns: mount type string
            :rtype: str
        )�fstype�fsZ_type)rrrrrJszFSMount.mount_typecCs|S)z� Any mandatory options can be added in this method.

            :param str options: an option string
            :returns: a modified option string
            :rtype: str
        r)r�optionsrrr�_modify_optionsSszFSMount._modify_optionscCs0|st|t�r&|jjp$dj|j�}|j|�S)z� The options used for mounting.

           :param options: mount options
           :type options: str or NoneType
           :returns: the options used by the task
           :rtype: str
        �,)�
isinstance�strr(Z	mountoptsrr)r*)rr)rrr�
mount_options\szFSMount.mount_optionscCs~|j}|rtdj|���y"tj|jj||j|j|�d�}Wn.t	k
rh}ztd|��WYdd}~XnX|rztd|��dS)z�Create the format on the device and label if possible and desired.

           :param str mountpoint: mountpoint that overrides self.mountpoint
           :param options: mount options
           :type options: str or None
        �
)r'r)zmount failed: %sN)
Zavailability_errorsrrrZmountr(�devicerr.�OSError)rZ
mountpointr)Z
error_msgsZrc�errr�do_taskiszFSMount.do_task)N)�__name__�
__module__�__qualname__�__doc__�descriptionr)r'rZ	MOUNT_APP�ext�propertyrr!r#rr*r.r3�
__classcell__rr)r&rr"s
		
rc@seZdZdZdS)�AppleBootstrapFSMountZhfsN)r4r5r6r'rrrrr<�sr<c@s eZdZedd��Zdd�ZdS)�BindFSMountcCs g}|jjs|jd|j�|S)Nzapplication %s is not available)r9�	availabler$)rr%rrrr#�sz BindFSMount._availability_errorscCsdjd|g�S)Nr+Zbind)r)rr)rrrr*�szBindFSMount._modify_optionsN)r4r5r6r:r#r*rrrrr=�sr=c@seZdZddgZdS)�
DevPtsFSMountzgid=5zmode=620N)r4r5r6r)rrrrr?�sr?c@seZdZddgZdS)�
FATFSMountz
umask=0077zshortname=winntN)r4r5r6r)rrrrr@�sr@c@seZdZdZdS)�
EFIFSMountZvfatN)r4r5r6r'rrrrrA�srAc@seZdZdZdS)�HFSPlusMountZhfsplusN)r4r5r6r'rrrrrB�srBc@seZdZdgZdS)�Iso9660FSMount�roN)r4r5r6r)rrrrrC�srCc@seZdZedd��ZdS)�NoDevFSMountcCs|jjS)N)r(r0)rrrrr�szNoDevFSMount.mount_typeN)r4r5r6r:rrrrrrE�srEc@seZdZedd��ZdS)�NFSMountcCsdgS)Nznfs filesystem can't be mountedr)rrrrr#�szNFSMount._availability_errorsN)r4r5r6r:r#rrrrrF�srFc@seZdZddgZdS)�	NTFSMount�defaultrDN)r4r5r6r)rrrrrG�srGcs eZdZe�fdd��Z�ZS)�SELinuxFSMountcs tt|�j}tjs|jd�|S)Nzselinux not enabled)r"rIr#rZselinuxr$)rr%)r&rrr#�s
z#SELinuxFSMount._availability_errors)r4r5r6r:r#r;rr)r&rrI�srIc@seZdZdZdS)�StratisXFSMountZxfsN)r4r5r6r'rrrrrJ�srJc@s eZdZdd�Zedd��ZdS)�
TmpFSMountcCs6|jjrd}n|jj|jj�}djdd�||fD��S)Nr+css|]}|r|VqdS)Nr)r
�orrrr�sz-TmpFSMount._modify_options.<locals>.<genexpr>)r(Z_accept_default_sizeZ_size_optionZ_sizer)rr)Zsize_optrrrr*�szTmpFSMount._modify_optionscCs g}|jjs|jd|j�|S)Nzapplication %s is not available)r9r>r$)rr%rrrr#�szTmpFSMount._availability_errorsN)r4r5r6r*r:r#rrrrrK�s	rK)rr%rr�rZformatsrrr	r
ZBasicApplicationZFSTaskrr<r=r?r@rArBrCrErFrGrIrJrKrrrr�<module>s*^