ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/clproc.cpython-37.pyc

B

E!wdn�@sfddlmZddlmZddlmZddlZdZdZGdd�de�ZGd	d
�d
e�Z	Gdd�d�Z
dS)
�)�absolute_import)�division)�print_functionNz	/proc/lvel��c@seZdZdS)�ProcLveErrorN)�__name__�
__module__�__qualname__�r	r	�@/opt/alt/python37/lib/python3.7/site-packages/clcommon/clproc.pyrsrc@seZdZdS)�	NoSuchLvpN)rrrr	r	r	r
rsrc@s�eZdZefdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d&dd�Z
dd�Zd'dd�Zd(dd�Z
d)dd�Zdd�Zd*dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)+�ProcLvecCsd|_d|_||_d|_dS)NZlvp�list)�_lvpr
�proc_lve�_version)�selfrr	r	r
�__init__szProcLve.__init__cCstj�|j|j�S)z/
        Return path to /proc/lve/list
        )�os�path�joinrr
)rr	r	r
�
proc_lve_list"szProcLve.proc_lve_listc	CsN|jdk	r|jSt|����}|�d�}WdQRXt|�dd�d�|_|jS)z5
        Return /proc/lve filesystem version
        N��:�r)r�openr�read�int�rsplit)r�f�liner	r	r
�version(s
zProcLve.versioncCstj�|jd�S)N�map)rrrr)rr	r	r
�proc_lve_map3szProcLve.proc_lve_mapcCstj�|jd�S)z4
        Return path to /proc/lve/resellers
        Z	resellers)rrrr)rr	r	r
�proc_lve_resellers6szProcLve.proc_lve_resellerscCstj�|���S)z3
        Check present /proc/lve/resellers
        )rr�existsr#)rr	r	r
�resellers_supported<szProcLve.resellers_supportedrcCs4|dkr|��Stj�|��|jt|�|j�SdS)z,
        Generate path to list file
        rN)rrrrr#r�strr
)r�lvp_idr	r	r
�
get_list_pathBszProcLve.get_list_pathcCst|��d�d�d�S)Nr�,���)r�split)rrr	r	r
�_extract_idKszProcLve._extract_idc
cs�|j|d�}y$t|��}|����}WdQRXWn>tk
rn}z |jdkr\td�|���n�Wdd}~XYnX|�d�dd�}x$|D]}|�	|�|�
tj�fVq�WdS)N)r'�zNo such lvp id {}�
r)
r(rr�strip�IOError�errnor�formatr+r,�rstripr�linesep)rr'rZlist_�lines�err	r	r
�_linesNs


zProcLve._linesTccs2x,|j|d�D]\}}|tkr$|r$q|VqWdS)N)r')r7�LIMIT_LVP_ID)rr'Zwithout_limits�lve_idrr	r	r
r5\sz
ProcLve.linesccs2x,|j|d�D]\}}|tdfkr$q|VqWdS)N)r'r)r7r8)rr'r9�_r	r	r
�lve_id_listbszProcLve.lve_id_listccs@x:t�|���D](}|�|j�rt|t|j�d��VqWdS)z=
        Obtain from /proc/lve/resellers lvp id list
        N)r�listdirr#�
startswithrr�len)rZlvp_dirr	r	r
�lvp_id_listhszProcLve.lvp_id_listcCs&x |j|d�D]}||krdSqWdS)N)r'T)r;)r�id_r'r9r	r	r
�check_inside_listpszProcLve.check_inside_listcCstj�|�|��S)z1
        Check present lve top container
        )rrr$r()rr'r	r	r
�	exist_lvpuszProcLve.exist_lvpcCs0x*|��D]}|�|�r
|�||�r
|Sq
WdS)z1
        Find in which lve top container
        N)r?rBrA)rr@r'r	r	r
�detect_inside_lvp{szProcLve.detect_inside_lvpc	Csnt�}t|����}|����}WdQRX|�d�dd�}x,|D]$}|����\}}t|�|t|�<qBW|S)z7
        Obtain map from /proc/lve/map as dict
        Nr.r)�dictrr"rr/r+r)rZmap_dictZmap_r5rZ
lve_id_strZ
lvp_id_strr	r	r
r!�s
zProcLve.mapcs�fdd�t|�����D�S)Ncsg|]\}}|�kr|�qSr	r	)�.0Zlve_id_Zlvp_id_)r'r	r
�
<listcomp>�sz+ProcLve.map_lve_id_list.<locals>.<listcomp>)r
r!�items)rr'r	)r'r
�map_lve_id_list�szProcLve.map_lve_id_listN)r)r)rT)r)r)rrr�PROC_LVErrr r"r#r%r(r,r7r5r;r?rArBrCr!rHr	r	r	r
rs"
	




r)Z
__future__rrrrrIr8�	Exceptionrrrr	r	r	r
�<module>	s

Zerion Mini Shell 1.0