Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/system/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
mZmZd
�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys?
---
module: xfs_quota
short_description: Manage quotas on XFS filesystems
description:
  - Configure quotas on XFS filesystems.
  - Before using this module /etc/projects and /etc/projid need to be configured.
version_added: "2.8"
author:
- William Leemans (@bushvin)
options:
  type:
    description:
      - The XFS quota type.
    type: str
    required: true
    choices:
      - user
      - group
      - project
  name:
    description:
      - The name of the user, group or project to apply the quota to, if other than default.
    type: str
  mountpoint:
    description:
      - The mount point on which to apply the quotas.
    type: str
    required: true
  bhard:
    description:
      - Hard blocks quota limit.
      - This argument supports human readable sizes.
    type: str
  bsoft:
    description:
      - Soft blocks quota limit.
      - This argument supports human readable sizes.
    type: str
  ihard:
    description:
      - Hard inodes quota limit.
    type: int
  isoft:
    description:
      - Soft inodes quota limit.
    type: int
  rtbhard:
    description:
      - Hard realtime blocks quota limit.
      - This argument supports human readable sizes.
    type: str
  rtbsoft:
    description:
      - Soft realtime blocks quota limit.
      - This argument supports human readable sizes.
    type: str
  state:
    description:
      - Whether to apply the limits or remove them.
      - When removing limit, they are set to 0, and not quite removed.
    type: str
    default: present
    choices:
      - present
      - absent

requirements:
   - xfsprogs
s�
- name: Set default project soft and hard limit on /opt of 1g
  xfs_quota:
    type: project
    mountpoint: /opt
    bsoft: 1g
    bhard: 1g
    state: present

- name: Remove the default limits on /opt
  xfs_quota:
    type: project
    mountpoint: /opt
    state: absent

- name: Set default soft user inode limits on /home of 1024 inodes and hard of 2048
  xfs_quota:
    type: user
    mountpoint: /home
    isoft: 1024
    ihard: 2048

s�
bhard:
    description: the current bhard setting in bytes
    returned: always
    type: int
    sample: 1024
bsoft:
    description: the current bsoft setting in bytes
    returned: always
    type: int
    sample: 1024
ihard:
    description: the current ihard setting in bytes
    returned: always
    type: int
    sample: 100
isoft:
    description: the current isoft setting in bytes
    returned: always
    type: int
    sample: 100
rtbhard:
    description: the current rtbhard setting in bytes
    returned: always
    type: int
    sample: 1024
rtbsoft:
    description: the current rtbsoft setting in bytes
    returned: always
    type: int
    sample: 1024
N(t
AnsibleModulethuman_to_bytescC`s�	tdtdtdd�dtdd�dtdd�dtdd�d	tddd
t�dtdd�dtdd�d
tdd�dtdddddddg�dtddd
tddddg��
dt�}|jd}|jd}|jd	}|jd}|jd}|jd}|jd}|jd}|jd
}	|jd}
|dk	rxt|�}n|dk	r�t|�}n|dk	r�t|�}n|	dk	r�t|	�}	ntdt�}tjj	|�s|j
dd||�nt|�}|dkr6|j
dd||�n|dkrd}
d}|dkrc|}nd|dkr�d|dkr�d |dkr�d!|dkr�d"|dkr�|j
dd#||�nytj
|�WqRtk
r
}|j
dd$||�qRXnD|dkr�d%}
d}|dkr;|}nd&|dkr�d'|dkr�d(|dkr�|j
dd)||df|�nytj|�WqRtk
r�}|j
dd$||�qRXn�|dkrRd*}
d+}|dkr�|}nd,|dkrGd-|dkrGd.|dkrG|j
dd/||�n||kr|tjjd0�r||j
dd1|�n||kr�tjjd2�r�|j
dd3|�n||kr�|dk	r�t|�dkr�|j
dd4||�nt}||kr�d5|}t|||�\}}}|d6krv||d7<||d8<||d9<||d:<|j
dd;|�q�x0|jd<�D]}d=|kr�t}Pq�q�Wn|r2|jr2d>}t|||�\}}}|d6kr%||d7<||d8<||d9<||d:<|j
dd?|�nt|d<qR|rR|jrRt|d<qRn|
dkr�d6}d6}d6}d6}d6}d6}	nt||||d@�\}}t||||dA�\}}t||||dB�\}}td|d|d|d|d
|d|�|dC<g}|dk	rXt|�|krX|jdD|�t|�|d<n|dk	r�t|�|kr�|jdE|�t|�|d<n|dk	r�||kr�|jdF|�||d<n|dk	r||kr|jdG|�||d<n|	dk	rHt|	�|krH|jdH|	�t|	�|d
<n|dk	r�t|�|kr�|jdI|�t|�|d<nt|�d6kr\	|jr\	||kr�dJ|
dKj|�f}ndL|
dKj|�|f}t|||�\}}}|d6krO	||d7<||d8<||d9<||d:<|j
ddM|�nt|d<n(t|�d6kr�	|jr�	t|d<n|j|�dS(NNt
argument_spectbhardttypetstrtbsofttihardtinttisoftt
mountpointtrequiredtnametrtbhardtrtbsofttstatetdefaulttpresenttchoicestabsenttgrouptprojecttusertsupports_check_modetchangedtmsgsPath '%s' is not a mount pointsDPath '%s' is not a mount point or not located on an xfs file system.s-utroottuquotatmntoptstusrquotatquotatuqnoenforcet
qnoenforcesVPath '%s' is not mounted with the uquota/usrquota/quota/uqnoenforce/qnoenforce option.sUser '%s' does not exist.s-gtgquotatgrpquotatgqnoenforces[Path '%s' is not mounted with the gquota/grpquota/gqnoenforce option. (current options: %s)s-ps#0tpquotatprjquotatpqnoenforcesEPath '%s' is not mounted with the pquota/prjquota/pqnoenforce option.s
/etc/projectss$Path '/etc/projects' does not exist.s/etc/projids"Path '/etc/projid' does not exist.s/Entry '%s' has not been defined in /etc/projid.s
project %sitcmdtrctstdouttstderrsCould not get project state.s
sProject Id '%s' - is not set.s
project -ss*Could not get quota realtime block report.tbtitrtbt	xfs_quotasbsoft=%ssbhard=%ssisoft=%ssihard=%ss
rtbsoft=%ss
rtbhard=%sslimit %s -d %st slimit %s %s %ssCould not set limits.(RtdicttTruetparamstNoneR	tFalsetostpathtismountt	fail_jsontget_fs_by_mountpointtpwdtgetpwnamtKeyErrortgrptgetgrnamtisfiletget_project_idt
exec_quotatsplitt
check_modetquota_reportRtappendtlentjoint	exit_json(tmodulet
quota_typeRRRRRRRRRtresulttmpttype_argt
quota_defaulttetprj_setR/R0R1R2tlinet
current_bsoftt
current_bhardt
current_isoftt
current_ihardtcurrent_rtbsofttcurrent_rtbhardtlimit((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pytmain�s2!'	









		@		0		0*









	








c	C`s�d}d}|dkr!d}n*|dkr6d}n|dkrKd}n|dkrld}d	}	d
}
nB|dkr�d}d
}	d}
n!|dkr�d}d}	d
}
nt|d||f|�\}}}
|dkrtdtd|d|d|
�}|jdd|	|�nxw|jd�D]f}|j�j�}t|�dkr*|d|kr*t|d�|
}t|d�|
}Pq*q*W||fS(NRs-pRs-uRs-gR3s-btblocksiR4s-itinodesiR5s-rsrealtime blockssreport %s %siR R0R1R2R!s"Could not get quota report for %s.s
ii(	R;RIR8R<R@RJtstripRNR(RQRRRRt	used_typetsoftthardRUtused_argt	used_nametfactorR0R1R2RSRY((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyRLasF						%	"cC`s�dddg||g}|j|dt�\}}}d|jd�ksm|dkr�d|jd�kr�|jd	d
�n|||fS(NR6s-xs-ctuse_unsafe_shells%XFS_GETQUOTA: Operation not permitteds
is5xfs_quota: cannot set limits: Operation not permittedR!sNYou need to be root or have CAP_SYS_ADMIN capability to perform this operation(trun_commandR9RJR@(RQR/RR0R1R2((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyRI�s!cC`s�d}tdd���}x�|j�D]�}|j�j�}t|�dkr%|d|kr%|ddkr%ttddd	d
ddg|��}|d
jd
�|d
<Pq%q%WWdQX|S(Ns/proc/mountstriiitxfstspectfiletvfstypeR$tfreqtpassnot,(R;topent	readlinesRdRJRNR8tzip(RtmprtsRYRT((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyRA�s2'cC`sld}tdd��Q}xG|j�D]9}|j�jd�}|d|kr%|d}Pq%q%WWdQX|S(Ns/etc/projidRmt:ii(R;RuRvRdt	partition(RtprjidRyRY((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyRH�s
t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRER=RBtansible.module_utils.basicRR	RaRLRIRARHt__name__(((sD/usr/lib/python2.7/site-packages/ansible/modules/system/xfs_quota.pyt<module>	s&

H!	�	-	
		

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]