%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/group.pyo

�
���^c@@s�dZddlmZmZmZddlZddlmZddlZ	ddl
Z	ddddd�Zde
dddd�Zd�ZdS(u1
Management of user groups
=========================

The group module is used to create and manage group settings, groups can be
either present or absent. User/Group names can be passed to the ``adduser``,
``deluser``, and ``members`` parameters. ``adduser`` and ``deluser`` can be used
together but not with ``members``.

In Windows, if no domain is specified in the user or group name (i.e.
``DOMAIN\username``) the module will assume a local user or group.

.. code-block:: yaml

    cheese:
      group.present:
        - gid: 7648
        - system: True
        - addusers:
          - user1
          - users2
        - delusers:
          - foo

    cheese:
      group.present:
        - gid: 7648
        - system: True
        - members:
          - foo
          - bar
          - user1
          - user2
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@s|td|�}|stStjjj�r|dr`g|dD]}|j�^qA|d<n|r�g|D]!}tjjj|�j�^qm}n|r�g|D]!}tjjj|�j�^q�}n|rg|D]!}tjjj|�j�^q�}qni}i}|ryy-t	|�}|d|krF||d<nWqyt
tfk
rut|d<d|d<|SXn|d	k	r�|r�t
|d�j|�r�t
|d�|d<q�n/|r�t
|d�j|�r�||d<q�n|r3g|D]}||dkr�|^q�}	|	r3|	|d<q3n|rxg|D]}||dkr@|^q@}
|
rx|
|d<qxn|S(
up
    Return a dict of the changes required for a group if the group is present,
    otherwise return False.
    u
group.infoumembersugiduresultuInvalid giducommentudelusersuaddusersN(t__salt__tFalsetsalttutilstplatformt
is_windowstlowert
win_functionstget_sam_nametintt	TypeErrort
ValueErrortNonetsettsymmetric_difference(tnametgidtadduserstdeluserstmemberstlgrptusertchangetrett
users_2addt
users_2del((s5/usr/lib/python2.7/site-packages/salt/states/group.pyt_changes1sL	
*114

))c
C@sbi|d6id6td6dj|�d6}|d#k	rg|d#k	sO|d#k	rgd#|d<d|d<|S|r�|r�t|�jt|��s�d#|d<d|d<|Snt|||||�}|r}d|d<x9tj|�D](\}}	|dcd	j||	�7<q�Wtd
r%d#|d<|Sx�tj|�D]�\}}	|dkrdt	d||�q5n|d
kr�x|	D]}
t	d||
�qwWq5n|dkr�x|	D]}
t	d||
�q�Wq5n|dkr5t	d|dj
|��q5q5q5Wtjt	dj
jjdd#�t|||||�}|rit|d<|dcd7<i|d6|d<q}idd6|d<n|tkr^td
r�d#|d<dj|�|d<|St	d�}|d#k	r8d#}x,|D]$}
|
d|kr�|
d}Pq�q�W|d#k	r8t|d<dj|||�|d<|Snt	d|d|d|�r>d#}|rrdj
|�}n|r�dj
|�}n|r�t	d||�ntjt	dj
jjdd#�dj|�|d<t	d |�|d<t|||||�}|r[t|d<d!j|�|d<i|d6|d<q[q^t|d<d"j|�|d<n|S($ux
    Ensure that a group is present

    Args:

        name (str):
            The name of the group to manage

        gid (str):
            The group id to assign to the named group; if left empty, then the
            next available group id will be assigned. Ignored on Windows

        system (bool):
            Whether or not the named group is a system group.  This is essentially
            the '-r' option of 'groupadd'. Ignored on Windows

        addusers (list):
            List of additional users to be added as a group members. Cannot
            conflict with names in delusers. Cannot be used in conjunction with
            members.

        delusers (list):
            Ensure these user are removed from the group membership. Cannot
            conflict with names in addusers. Cannot be used in conjunction with
            members.

        members (list):
            Replace existing group members with a list of new members. Cannot be
            used in conjunction with addusers or delusers.

    Example:

    .. code-block:: yaml

        # Adds DOMAIN\db_admins and Administrators to the local db_admin group
        # Removes Users
        db_admin:
          group.present:
            - addusers:
              - DOMAIN\db_admins
              - Administrators
            - delusers:
              - Users

        # Ensures only DOMAIN\domain_admins and the local Administrator are
        # members of the local Administrators group. All other users are
        # removed
        Administrators:
          group.present:
            - members:
              - DOMAIN\domain_admins
              - Administrator
    unameuchangesuresultu#Group {0} is present and up to dateucommentuaError: Conflicting options "members" with "addusers" and/or "delusers" can not be used together. u?Error. Same user(s) can not be added and deleted simultaneouslyu6The following group attributes are set to be changed:
u	{0}: {1}
utestugidugroup.chgiduaddusersu
group.adduserudelusersu
group.deluserumembersu
group.membersu,u	test.pingugroup.getentu!Some changes could not be applieduFailedu All changes applied successfullyuFinaluGroup {0} set to be addeduBGroup {0} is not present but gid {1} is already taken by group {2}u	group.addRtsystemuNew group {0} createdu
group.infouAGroup {0} has been created but, some changes could not be applieduFailed to create new group {0}N(tTruetformatRRt
isdisjointRRt	iteritemst__opts__Rtjointsystmodulest
__module__t__context__tpopR(RRRRRRRtchangestkeytvalRtgrpst	gid_groupRtgrp_members((s5/usr/lib/python2.7/site-packages/salt/states/group.pytpresentks�;
$



	
 





	







	


cC@s�i|d6id6td6dd6}td|�}|r�tdrcd
|d<dj|�|d<|Std	|�|d<|dr�id|6|d<d
j|�|d<|Sdj|�|d<|Snd|d<|Sd
S(u�
    Ensure that the named group is absent

    Args:
        name (str):
            The name of the group to remove

    Example:

    .. code-block:: yaml

        # Removes the local group `db_admin`
        db_admin:
          group.absent
    unameuchangesuresultuucommentu
group.infoutestuGroup {0} is set for removalugroup.deleteuRemoved group {0}uFailed to remove group {0}uGroup not presentN(R RR$RR!(RRtgrp_info((s5/usr/lib/python2.7/site-packages/salt/states/group.pytabsent s&





(t__doc__t
__future__RRRR&tsalt.extRtsalt.utils.platformRtsalt.utils.win_functionsRRRR1R3(((s5/usr/lib/python2.7/site-packages/salt/states/group.pyt<module>#s7�

Zerion Mini Shell 1.0