File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/linux_acl.cpython-310.pyc
o
�N�g-e � @ sj d Z ddlZddlZddlZddlmZ e�e�Z dZ
dd� Zdd d
�Zddd�Z
dd
d�Zddd�ZdS )a�
Linux File Access Control Lists
The Linux ACL state module requires the `getfacl` and `setfacl` binaries.
Ensure a Linux ACL is present
.. code-block:: yaml
root:
acl.present:
- name: /root
- acl_type: user
- acl_name: damian
- perms: rwx
Ensure a Linux ACL does not exist
.. code-block:: yaml
root:
acl.absent:
- name: /root
- acl_type: user
- acl_name: damian
- perms: rwx
Ensure a Linux ACL list is present
.. code-block:: yaml
root:
acl.list_present:
- name: /root
- acl_type: user
- acl_names:
- damian
- homer
- perms: rwx
Ensure a Linux ACL list does not exist
.. code-block:: yaml
root:
acl.list_absent:
- name: /root
- acl_type: user
- acl_names:
- damian
- homer
- perms: rwx
.. warning::
The effective permissions of Linux file access control lists (ACLs) are
governed by the "effective rights mask" (the `mask` line in the output of
the `getfacl` command) combined with the `perms` set by this module: any
permission bits (for example, r=read) present in an ACL but not in the mask
are ignored. The mask is automatically recomputed when setting an ACL, so
normally this isn't important. However, if the file permissions are
changed (with `chmod` or `file.managed`, for example), the mask will
generally be set based on just the group bits of the file permissions.
As a result, when using `file.managed` or similar to control file
permissions as well as this module, you should set your group permissions
to be at least as broad as any permissions in your ACL. Otherwise, the two
state declarations will each register changes each run, and if the `file`
declaration runs later, your ACL will be ineffective.
� N)�CommandExecutionErrorZaclc C s$ t jj�d�rt jj�d�rtS dS )z(
Ensure getfacl & setfacl exist
ZgetfaclZsetfacl)FzWThe linux_acl state cannot be loaded: the getfacl or setfacl binary is not in the path.)�salt�utils�path�which�__virtualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/linux_acl.py�__virtual__T s r
� Fc s� | di dd�}ddddd�� d d
ddd
�}t j�| �s(| � d�|d<