HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/pw_group.cpython-310.pyc
o

�N�g8�@s�dZddlZddlZddlZzddlZWn	eyYnwe�e�Z	dZ
dd�Zddd�Zdd	�Z
d
d�Zdd
d�Zdd�Zdd�Zdd�Zdd�ZdS)a
Manage groups on FreeBSD

.. important::
    If you feel that Salt should be using this module to manage groups on a
    minion, and it is using a different module (or gives an error similar to
    *'group.info' is not available*), see :ref:`here
    <module-provider-override>`.
�N�groupcCstddvrtSdS)zC
    Set the user module if the kernel is FreeBSD or Dragonfly
    Zkernel)ZFreeBSDZ	DragonFly)FzHThe pw_group execution module cannot be loaded: system is not supported.)Z
__grains__�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/pw_group.py�__virtual__srcKs�tjjjdi|��}tjj�|�dd��rt�d�d|vr#t�d�|r*t�d�d}|r6|d|�d	�7}|�d
|��}t	d|dd�}|d
S)z�
    .. versionchanged:: 3006.0

    Add the specified group

    name
        Name of the new group

    gid
        Use GID for the new group

    CLI Example:

    .. code-block:: bash

        salt '*' group.add foo 3456
    �systemFz6pw_group module does not support the 'system' argumentZ
non_uniquez;The non_unique parameter is not supported on this platform.z"Invalid kwargs passed to group.addzpw groupadd z-g � z -n �cmd.run_all�Zpython_shell�retcodeNr)
�salt�utils�argsZclean_kwargs�dataZis_true�pop�log�warning�__salt__)�name�gid�kwargs�cmd�retrrr�add's



rcCs tdd|��dd�}|dS)zo
    Remove the named group

    CLI Example:

    .. code-block:: bash

        salt '*' group.delete foo
    r	zpw groupdel Fr
r�r)rrrrr�deleteJs

rcCs<zt�|�}WntyiYSw|j|j|j|jd�S)zw
    Return information about a group

    CLI Example:

    .. code-block:: bash

        salt '*' group.info foo
    )r�passwdr�members)�grp�getgrnam�KeyError�gr_name�	gr_passwd�gr_gid�gr_mem)r�grinforrr�infoYs
��r&FcCsBdtvr
|s
tdSg}t��D]
}|�t|j��q|td<|S)zn
    Return info on all groups

    CLI Example:

    .. code-block:: bash

        salt '*' group.getent
    zgroup.getent)�__context__r�getgrall�appendr&r!)Zrefreshrr%rrr�getentps
r*cCsXtd|�}||krdSd|�d|��}td|dd�td|�}||kr*||kSdS)z}
    Change the gid for a named group

    CLI Example:

    .. code-block:: bash

        salt '*' group.chgid foo 4376
    zfile.group_to_gidT�pw groupmod z -g zcmd.runFr
r)rrZpre_gidrZpost_gidrrr�chgid�s
r,cC�"tdd|�d|��dd�}|S)z�
    Add a user in the group.

    CLI Example:

    .. code-block:: bash

         salt '*' group.adduser foo bar

    Verifies if a valid username 'bar' as a member of an existing group 'foo',
    if not then adds it.
    �cmd.retcoder+z -m Fr
r)r�usernamerrrr�adduser�s�r0cCs>td|�}||dvrdStdd|�d|��dd�}|S)	z�
    Remove a user from the group.

    CLI Example:

    .. code-block:: bash

         salt '*' group.deluser foo bar

    Removes a member user 'bar' from a group 'foo'. If group is not present
    then returns True.
    z
group.inforTr.r+z -d Fr
r)rr/Zgrp_inforrrr�deluser�s
�r1cCr-)a'
    Replaces members of the group with a provided list.

    .. versionadded:: 2015.5.4

    CLI Example:

    .. code-block:: bash

        salt '*' group.members foo 'user1,user2,user3,...'

    Replaces a membership list for a local group 'foo'.
        foo:x:1234:user1,user2,user3,...
    r.r+z -M Fr
r)rZmembers_listrrrrr�s�r)N)F)�__doc__�loggingZsalt.utils.argsrZsalt.utils.datar�ImportError�	getLogger�__name__rrrrrr&r*r,r0r1rrrrr�<module>s(
�

#