Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZm
Z
dd
lmZd�Zded�Zdd�Zd�Zed�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatustcoretsupported_bys 
---
module: acl
version_added: '1.4'
short_description: Set and retrieve file ACL information.
description:
- Set and retrieve file ACL information.
options:
  path:
    description:
    - The full path of the file or object.
    type: path
    required: yes
    aliases: [ name ]
  state:
    description:
    - Define whether the ACL should be present or not.
    - The C(query) state gets the current ACL without changing it, for use in C(register) operations.
    choices: [ absent, present, query ]
    default: query
  follow:
    description:
    - Whether to follow symlinks on the path if a symlink is encountered.
    type: bool
    default: yes
  default:
    description:
    - If the target is a directory, setting this to C(yes) will make it the default ACL for entities created inside the directory.
    - Setting C(default) to C(yes) causes an error if the path is a file.
    type: bool
    default: no
    version_added: '1.5'
  entity:
    description:
    - The actual user or group that the ACL applies to when matching entity types user or group are selected.
    version_added: '1.5'
  etype:
    description:
    - The entity type of the ACL to apply, see C(setfacl) documentation for more info.
    choices: [ group, mask, other, user ]
    version_added: '1.5'
  permissions:
    description:
    - The permissions to apply/remove can be any combination of C(r), C(w) and C(x) (read, write and execute respectively)
    version_added: '1.5'
  entry:
    description:
    - DEPRECATED.
    - The ACL to set or remove.
    - This must always be quoted in the form of C(<etype>:<qualifier>:<perms>).
    - The qualifier may be empty for some types, but the type and perms are always required.
    - C(-) can be used as placeholder when you do not care about permissions.
    - This is now superseded by entity, type and permissions fields.
  recursive:
    description:
    - Recursively sets the specified ACL.
    - Incompatible with C(state=query).
    type: bool
    default: no
    version_added: '2.0'
  use_nfsv4_acls:
    description:
    - Use NFSv4 ACLs instead of POSIX ACLs.
    type: bool
    default: no
    version_added: '2.2'
  recalculate_mask:
    description:
    - Select if and when to recalculate the effective right masks of the files.
    - See C(setfacl) documentation for more info.
    - Incompatible with C(state=query).
    choices: [ default, mask, no_mask ]
    default: default
    version_added: '2.7'
author:
- Brian Coca (@bcoca)
- Jérémie Astori (@astorije)
notes:
- The C(acl) module requires that ACLs are enabled on the target filesystem and that the C(setfacl) and C(getfacl) binaries are installed.
- As of Ansible 2.0, this module only supports Linux distributions.
- As of Ansible 2.3, the I(name) option has been changed to I(path) as default, but I(name) still works as well.
s�
- name: Grant user Joe read access to a file
  acl:
    path: /etc/foo.conf
    entity: joe
    etype: user
    permissions: r
    state: present

- name: Removes the ACL for Joe on a specific file
  acl:
    path: /etc/foo.conf
    entity: joe
    etype: user
    state: absent

- name: Sets default ACL for joe on /etc/foo.d/
  acl:
    path: /etc/foo.d/
    entity: joe
    etype: user
    permissions: rw
    default: yes
    state: present

- name: Same as previous but using entry shorthand
  acl:
    path: /etc/foo.d/
    entry: default:user:joe:rw-
    state: present

- name: Obtain the ACL for a specific file
  acl:
    path: /etc/foo.conf
  register: acl_info
s�
acl:
    description: Current ACL on provided path (after changes, if any)
    returned: success
    type: list
    sample: [ "user::rwx", "group::rwx", "other::rwx" ]
N(t
AnsibleModuletget_platform(t	to_nativecC`s�|jd�}d
}|j�jd�r@t}|jd�nt|�dkrb|jd
�n|\}}}|j�}|jd�r�d}nN|jd�r�d}n6|jd	�r�d
}n|jd�r�d}nd
}||||gS(s+ splits entry and ensures normalized returnt:tdiitutusertgtgrouptmtmasktototherN(tsplittNonetlowert
startswithtTruetpoptlentappend(tentrytaRtttetp((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pytsplit_entry�s&				cC`sE|rdj|||dg�S|r9|d|d|S|d|S(sbBuilds and returns an entry string. Does not include the permissions bit if they are not provided.Rtallow(tjoin(tetypetentitytpermissionstuse_nfsv4_acls((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pytbuild_entry�s
tc	C`s�|dkr7|jdt�g}|jd|g�n~|dkrn|jdt�g}|jd|g�nG|jdt�g}t�j�dkr�|jd�|jd	�n|r�|jd
�n|dkr�|dkr�|jd�n(|d
kr|dkr|jd�n|snt�j�dkrF|jd�qnt�j�dkrn|jd�qnn|r�|jdd�n|j|�|S(s-Builds and returns a getfacl/setfacl command.tsettsetfacls-mtrms-xtgetfacltlinuxs
--omit-headers--absolute-namess--recursiveRs--masktno_masks	--no-masks
--physicaltfreebsds-his-d(ssetR-(ssetR-(tget_bin_pathRtextendR	RRtinsert(	tmoduletmodetpathtfollowtdefaultt	recursivetrecalculate_maskRtcmd((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pyt
build_command�s2

cC`sgt�j�dkrtS|}|jdd�t||�}x!|D]}|jd�sFtSqFWtS(sPReturns true if the provided command affects the existing ACLs, false otherwise.R1is--tests*,*(R	RRR4trun_acltendswithtFalse(R5R<tlinestline((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pytacl_changed�s
c	C`s�y"|j|d|�\}}}Wn)tk
rM}|jdt|��nXg}x9|j�D]+}|jd�sa|j|j��qaqaW|r�|dj�r�|d S|S(Ntcheck_rctmsgt#i����(	trun_commandt	Exceptiont	fail_jsonR
t
splitlinesRRtstripR(	R5R<RDtrctoutterrR RAtl((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pyR>�s"cC`sutdtdtdddtddg�dtdd�d	tddd
d�dtddd
ddddg�dtdd�dtddd
dd
dddg�dtddd
t�d
tddd
t�dtddd
t�dtddd
d
d
d
ddg�dtddd
t��dt�}t�j�d9krN|jd d!�n|jjd�}|jjd�}|jjd	�}|jjd�}|jjd�}|jjd�}|jjd�}|jjd
�}|jjd�}	|jjd�}
|jjd�}t	j
j|�s9|jd d"�n|dkr�|	r^|jd d#�n|
d:kr�|jd d$�q�n|s�|dkr�|r�|jd d%�n|dkr�|r�|jd d&�n|d;kr�|r�|jd d'|�q�n|r�|s|s|r)|jd d(�n|dkr]|jd)�d<kr]|jd d,�n|dkr�|jd)�d=kr�|jd d.�n|dkr�|jd d/�nt
|�\}}}}|dk	r�|}q�nt�j�dkr|	r|jd d0�qnt}
d}|dkr�t||||�}t|d1||||	|
|�}t||�}
|
r�|jr�t||�nd2|}n�|dkrt|||�}t|d3||||	|
|�}t||�}
|
r|jrt||t�nd4|}n|dkr.d5}nt|t|d6||||	|
��}|jd7|
d |d8|�dS(>Nt
argument_specR7ttypetrequiredtaliasestnameRtstrR&R9R*R%tchoicesRRRRR'tstatetquerytabsenttpresentR8tboolR:R;R0R(tsupports_check_modeR/R1REs/The acl module is not available on this system.s!Path not found or not accessible.s/'recursive' MUST NOT be set when 'state=query'.sM'recalculate_mask' MUST NOT be set to 'mask' or 'no_mask' when 'state=query'.s2'permissions' MUST NOT be set when 'state=absent'.s)'entity' MUST be set when 'state=absent'.s$'etype' MUST be set when 'state=%s'.sH'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.RiisF'entry' MUST have 3 or 4 sections divided by ':' when 'state=present'.isE'entry' MUST have 2 or 3 sections divided by ':' when 'state=absent'.s+'entry' MUST NOT be set when 'state=query'.s,recursive is not supported on that platform.R+s
%s is presentR-s%s is absentscurrent acltgettchangedtacl(slinuxsfreebsd(smasksno_mask(RZRY(ii(ii(RtdictRR@R	RRItparamsR]tosR7texiststcountR"RR)R=RCt
check_modeR>t	exit_json(R5R7RR&R%R'RWR8R9R:R;R(tdefault_flagR^REtcommandR_((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pytmains�	!!

	!t__main__(t
__future__RRRRQt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRbtansible.module_utils.basicRR	tansible.module_utils._textR
R"RR@R)R=RCRR>Rit__name__(((s=/usr/lib/python2.7/site-packages/ansible/modules/files/acl.pyt<module>s$


S%	$		{

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