Mini Shell

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

3

{)c��@s�ddlZddlZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
eej�Gd
d�de
je	j
��ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de	j�ZdS)�N)�
add_metaclass�)�FSReadLabelError)�util�)�availability)�fstask)�taskc@sHeZdZdZdZejdd�Zejdd�Ze	dd��Z
dd	�Zd
d�ZdS)
�FSReadLabelzA An abstract class that represents reading a filesystem's label. zread filesystem labelz5Matches the string output by the reading application.)�doczarguments for reading a label.cCst|j�g|jS)zvGet the command to read the filesystem label.

           :return: the command
           :rtype: list of str
        )�str�ext�args)�self�r�!/usr/lib/python3.6/fsreadlabel.py�
_read_command0szFSReadLabel._read_commandcCs.tj|j|�}|dkr$td|j��|jd�S)z�Extract the label from an output string.

           :param str labelstr: the string containing the label information

           :return: the label
           :rtype: str

           Raises an FSReadLabelError if the label can not be extracted.
        Nz!Unknown format for application %s�label)�re�match�label_regexrr
�group)rZlabelstrrrrr�_extract_label9s
zFSReadLabel._extract_labelcCsV|j}|rtdj|���tj|j�\}}|dkr8td��|j�}|dkrL|S|j|�S)z\ Get the label.

            :returns: the filesystem label
            :rtype: str
        �
rzread label failed�)Zavailability_errorsr�joinrZrun_program_and_capture_outputr�stripr)rZ
error_msgsZrc�outrrrr�do_taskHszFSReadLabel.do_taskN)
�__name__�
__module__�__qualname__�__doc__�description�abc�abstractpropertyrr�propertyrrrrrrrr
#s	r
c@s"eZdZejZdZedd��ZdS)�DosFSReadLabelz
(?P<label>.*)cCs
|jjgS)N)�fs�device)rrrrr_szDosFSReadLabel.argsN)	rr r!rZDOSFSLABEL_APPr
rr&rrrrrr'[sr'c@s"eZdZejZdZedd��ZdS)�Ext2FSReadLabelz
(?P<label>.*)cCs
|jjgS)N)r(r))rrrrrhszExt2FSReadLabel.argsN)	rr r!rZE2LABEL_APPr
rr&rrrrrr*dsr*c@s"eZdZejZdZedd��ZdS)�
NTFSReadLabelz
(?P<label>.*)cCs
|jjgS)N)r(r))rrrrrqszNTFSReadLabel.argsN)	rr r!rZ
NTFSLABEL_APPr
rr&rrrrrr+msr+c@s"eZdZejZdZedd��ZdS)�XFSReadLabelzlabel = "(?P<label>.*)"cCsd|jjgS)Nz-l)r(r))rrrrrzszXFSReadLabel.argsN)	rr r!rZXFSADMIN_APPr
rr&rrrrrr,vsr,c@seZdZdS)�UnimplementedFSReadLabelN)rr r!rrrrr-sr-)r$rZsixr�errorsrrrrrr	�ABCMetaZBasicApplicationZFSTaskr
r'r*r+r,ZUnimplementedFSTaskr-rrrr�<module>s7