%PDF- %PDF-
| Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/ |
| Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/clquota.cpython-37.pyc |
B
`�1bc � @ sn d dl mZ d dl mZ d dl mZ d dlZd dlZd dlmZmZ e� d�Z
dd� Zdd
d�Zdd
d�Z
dS )� )�absolute_import)�division)�print_functionN)�run_command�ExternalProgramFailedzuser quota on .+ \(.+\) is onc C s: t j�| �d �dd�} t j�|�d �dd�}|�| �S )z�
>>> is_subpath('/', '/home')
True
>>> is_subpath('/home', '/home')
True
>>> is_subpath('/', '/')
True
>>> is_subpath('/d', '/f')
False
�/z//)�os�path�abspath�replace�
startswith)r Zsubpath� r
�A/opt/alt/python37/lib/python3.7/site-packages/clcommon/clquota.py�
is_subpath s r �/proc/mountsc C sD t |�}d }x*|D ]"}|�d�d }t|| �r|}P qW |�� |S )N� � )�open�splitr �close)r Z_mounts�stream�mount_point�lineZmount_point_r
r
r �get_mount_point$ s
r �/homec
C sp t j�d�sdS t| �}ytdd|g�}W n* tk
rT } zt|�}W dd}~X Y nX |�� }t� |�sl|S dS )z�
Check if quotas enabled and initialised for specific path
:return: string message with giagnostick information if disabled; None if enabled
z
/sbin/quotaonzPackage "quota" not installedz-upN)
r r �isfiler r r �str�strip�USER_QUOTA_ON_PATTERN�search)r r Zquotaon_output�er
r
r �check_quota_enabled0 s
r! )r )r )Z
__future__r r r �rer Zclcommon.utilsr r �compiler r r r! r
r
r
r �<module> s