%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
mZeje
�Zidd6Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�ZdS(u3
Module for managing quotas on POSIX-like systems.
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationErrorusetuset_cC@s6tjjj�r,tjjjd�r,dStdfS(uH
    Only work on POSIX-like systems with setquota binary available
    usetquotauquotau�The quota execution module cannot be loaded: the module is only available on POSIX-like systems with the setquota binary available.(tsalttutilstplatformt
is_windowstpathtwhichtFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pyt__virtual__s
cC@s?ii|6}t|d�||d<t|d�||d<|S(u�
    Report on quotas for a specific volume

    CLI Example:

    .. code-block:: bash

        salt '*' quota.report /media/data
    u-uuUser Quotasu-guGroup Quotas(t_parse_quota(tmounttret((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytreport&s

c
C@s=dj||�}td|dt�j�}d}d|krId}nd|kr^d}nii|6}x�|D]�}|s�qrn|j�}|dkrd	|kr�|jd
�\}	}
|	jd�}|
jd�}|d|d
<|d|d<q5|jd�r5d}q5qr|dkrrt|�dkr9qrn|d||krbi|||d<n|d|||dd<|d|||dd<|d|||dd<|d|||dd<|d|||dd<|d|||dd<|d|||dd<|d |||dd!<qrqrW|S("uK
    Parse the output from repquota. Requires that -u -g are passed in
    urepquota -vp {0} {1}ucmd.runtpython_shelluheaderu-uuUsersu-guGroupsuBlock grace timeu;u: i����uBlock Grace TimeuInode Grace Timeu-uquotasiiiu
block-usediublock-soft-limitiublock-hard-limitiublock-graceiu	file-usediufile-soft-limitufile-hard-limiti	u
file-grace(tformatt__salt__Rt
splitlinestsplitt
startswithtlen(
Rtoptstcmdtouttmodet	quotatypeRtlinetcompstblockgtinodegtblockgctinodegc((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pyR
6sF		

!c	K@s�idd6dd6dd6dd6}d}d}d|kr�|dj|d�7}t|d	�}|d|kr�|d
|d}n|}dj|d�}nd|kr/d|kr�td
��n|dj|d�7}t|d�}|d|kr|d|d}n|}dj|d�}n|sDtd��nx+dD]#}||krK||||<qKqKW|dj|d|d|d|d|�7}td|dt�}|ddkr�tdj|d���ni||6S(u
    Calls out to setquota, for a specific user or group

    CLI Example:

    .. code-block:: bash

        salt '*' quota.set /media/data user=larry block-soft-limit=1048576
        salt '*' quota.set /media/data group=painters file-hard-limit=1000
    iublock-soft-limitublock-hard-limitufile-soft-limitufile-hard-limitusetquotauuseru -u {0} u-uuUsersu	User: {0}ugroupu)Please specify a user or group, not both.u -g {0} u-guGroupsu
Group: {0}u#A valid user or group was not foundu{0} {1} {2} {3} {4}ucmd.run_allRuretcodeu0Unable to set desired quota. Error follows: 
{0}ustderrN(ublock-soft-limitublock-hard-limitufile-soft-limitufile-hard-limit(tNoneRR
RRRR(	tdevicetkwargstemptytcurrentRtparsedRtlimittresult((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytset_asL

cC@stdd�dS(u�
    Runs the warnquota command, to send warning emails to users who
    are over their quota limit.

    CLI Example:

    .. code-block:: bash

        salt '*' quota.warn
    ucmd.runu	quotawarnN(R(((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytwarn�scC@s^i}tdd�j�}x;|D]3}|s5q#n|jd�}|d||d<q#W|S(u�
    Runs the quotastats command, and returns the parsed output

    CLI Example:

    .. code-block:: bash

        salt '*' quota.stats
    ucmd.runu
quotastatsu: ii(RRR(RRRR((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytstats�s

cC@s'dj|�}td|dt�tS(uj
    Turns on the quota system

    CLI Example:

    .. code-block:: bash

        salt '*' quota.on
    uquotaon {0}ucmd.runR(RRRtTrue(R$R((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pyton�s
cC@s'dj|�}td|dt�tS(ul
    Turns off the quota system

    CLI Example:

    .. code-block:: bash

        salt '*' quota.off
    uquotaoff {0}ucmd.runR(RRRR.(R$R((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytoff�s
cC@si}dj|�}td|dt�}x�|j�D]�}|j�j�}|d|kr�|djd�r�|djd�r�d	||d
<q8q8|djd�r8d||<|Sq8ni|d
jd
d�jdd�d6||d<n|d||d|d<q8W|S(u�
    Report whether the quota system for this device is on or off

    CLI Example:

    .. code-block:: bash

        salt '*' quota.get_mode
    uquotaon -p {0}ucmd.runRiiuquotaoniu
MountpointudisablediuCannotu	Not foundu(uu)udevicei(RRRRtstripRRtreplace(R$RRRRR((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pytget_mode�s$

1(t__doc__t
__future__RRRtloggingtsalt.utils.pathRtsalt.utils.platformtsalt.exceptionsRRt	getLoggert__name__tlogt__func_alias__RRR
R+R,R-R/R0R3(((s6/usr/lib/python2.7/site-packages/salt/modules/quota.pyt<module>s"
			+	=				

Zerion Mini Shell 1.0