%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZyddlZeZWnek
rQe	ZnXddl
Z
ddlZddlZ
ddlZ
ddlmZddlmZeje�ZdZd�Zd�Zd	�Zd
�Zdddddedddded�Ze	e	d
�Ze	d�Zd�Zd�Z d�Z!e	d�Z"e	d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+dS(u&
Manage users with the useradd command

.. important::

    If you feel that Salt should be using this module to manage users on a
    minion, and it is using a different module (or gives an error similar to
    *'user.info' is not available*), see :ref:`here
    <module-provider-override>`.

i(tabsolute_importtunicode_literalstprint_functionN(tsix(tCommandExecutionErroruusercC@s$tddkrtrtStdfS(u4
    Set the user module if the kernel is SunOS
    ukerneluSunOSunThe solaris_user execution module failed to load: only available on Solaris systems with pwd module installed.(t
__grains__tHAS_PWDt__virtualname__tFalse(((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt__virtual__$scC@s�tj|�jjdd�}|s(iSx#t|�dkrM|jd�q+Witj|d�d6tj|d�d6tj|d	�d
6tj|d�d6SdS(
uD
    Retrieve GECOS field info and return it in dictionary form
    u,iiuiufullnameiu
roomnumberiu	workphoneu	homephoneN(tpwdtgetpwnamtpw_gecostsplittlentappendRt	text_type(tnametgecos_field((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt
_get_gecos.scC@sFdj|jdd�|jdd�|jdd�|jdd��S(u�
    Accepts a dictionary entry containing GECOS field names and their values,
    and returns a full GECOS comment string, to be used with usermod.
    u{0},{1},{2},{3}ufullnameuu
roomnumberu	workphoneu	homephone(tformattget(t
gecos_dict((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt_build_gecos?scC@s�t|tj�s$tj|�}nt|�}|s:tS|||krNtStj|�}|||<ddt	|�|g}t
d|dt�t|�}t|�j|�|kS(u:
    Common code to change a user's GECOS information
    uusermodu-cucmd.runtpython_shell(
t
isinstanceRtstring_typesRRRtTruetcopytdeepcopyRt__salt__tinfoR(Rtkeytvaluetpre_infot
gecos_datatcmdt	post_info((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt
_update_gecosJs
ucK@s�tjjj|jdt��r1tjd�n|rGtjd�nt|t	j
�rk|jd�}ndg}
|r�|
jd|g�n|r�|
jd|g�n|r�|
jd|g�n|r�|
jd	dj
|�g�n|r|
jd
�n|dk	r%|
jd|g�n|s;|
jd�n|
j|�td
|
dt�dkrhtS|r~t||�n|r�t||�n|	r�t||	�n|
r�t||
�ntSdS(u�
    Add a user to the minion

    CLI Example:

    .. code-block:: bash

        salt '*' user.add name <uid> <gid> <groups> <home> <shell>
    usystemu:solaris_user module does not support the 'system' argumentu!Invalid kwargs passed to user.addu,uuseraddu-su-uu-gu-Gu-mu-du-oucmd.retcodeRiN(tsalttutilstdatatis_truetpopRtlogtwarningRRRR
textendtjoinRtNoneRt
chfullnametchroomnumbertchworkphonetchhomephoneR(Rtuidtgidtgroupsthometshelltuniquetfullnamet
roomnumbert	workphonet	homephonet
createhometkwargsR$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytadd]sB!	

cC@sktjjj|�r%tjd�ndg}|rD|jd�n|j|�td|dt�dkS(u�
    Remove a user from the minion

    CLI Example:

    .. code-block:: bash

        salt '*' user.delete name remove=True force=True
    uDuserdel does not support force-deleting user while user is logged inuuserdelu-rucmd.retcodeRi(	R'R(R)R*R,R-RRR(RtremovetforceR$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytdelete�s

	
cC@s\dtkr|rtdSg}x*tj�D]}|jt|j��q.W|td<|S(u}
    Return the list of all info for all users

    CLI Example:

    .. code-block:: bash

        salt '*' user.getent
    uuser.getent(t__context__R
tgetpwallRRtpw_name(trefreshtretR)((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytgetent�s

cC@s}t|�}|s*tdj|���n||dkr>tSdd||g}td|dt�t|�jd�|kS(u{
    Change the uid for a named user

    CLI Example:

    .. code-block:: bash

        salt '*' user.chuid foo 4376
    uUser '{0}' does not existuuiduusermodu-uucmd.runR(RRRRRRR(RR5R"R$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytchuid�s
cC@s}t|�}|s*tdj|���n||dkr>tSdd||g}td|dt�t|�jd�|kS(u�
    Change the default group of the user

    CLI Example:

    .. code-block:: bash

        salt '*' user.chgid foo 4376
    uUser '{0}' does not existugiduusermodu-gucmd.runR(RRRRRRR(RR6R"R$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytchgid�s
cC@s}t|�}|s*tdj|���n||dkr>tSdd||g}td|dt�t|�jd�|kS(u�
    Change the default shell of the user

    CLI Example:

    .. code-block:: bash

        salt '*' user.chshell foo /bin/zsh
    uUser '{0}' does not existushelluusermodu-sucmd.runR(RRRRRRR(RR9R"R$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytchshell�s
cC@s�t|�}|s*tdj|���n||dkr>tSdd|g}|rc|jd�n|j|�td|dt�t|�jd�|kS(u�
    Set a new home directory for an existing user

    name
        Username to modify

    home
        New home directory to set

    persist : False
        Set to ``True`` to prevent configuration files in the new home
        directory from being overwritten by the files from the skeleton
        directory.

    CLI Example:

    .. code-block:: bash

        salt '*' user.chhome foo /home/users/foo True
    uUser '{0}' does not existuhomeuusermodu-du-mucmd.runR(RRRRRRRR(RR8tpersistR"R$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytchhomes
cC@s�t|tj�r$|jd�}ntt|��}|t|�krLtS|rb|j|�ndddj|�|g}t	d|dt
�dkS(u�
    Change the groups to which a user belongs

    name
        Username to modify

    groups
        List of groups to set for the user. Can be passed as a comma-separated
        list or a Python list.

    append : False
        Set to ``True`` to append these groups to the user's existing list of
        groups. Otherwise, the specified groups will replace any existing
        groups for the user.

    CLI Example:

    .. code-block:: bash

        salt '*' user.chgroups foo wheel,root True
    u,uusermodu-Gucmd.retcodeRi(RRRR
tsettlist_groupsRtupdateR/RR(RR7RtugrpsR$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytchgroups2scC@st|d|�S(u�
    Change the user's Full Name

    CLI Example:

    .. code-block:: bash

        salt '*' user.chfullname foo "Foo Bar"
    ufullname(R&(RR;((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyR1Ss
cC@st|d|�S(u
    Change the user's Room Number

    CLI Example:

    .. code-block:: bash

        salt '*' user.chroomnumber foo 123
    u
roomnumber(R&(RR<((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyR2`s
cC@st|d|�S(u�
    Change the user's Work Phone

    CLI Example:

    .. code-block:: bash

        salt '*' user.chworkphone foo "7735550123"
    u	workphone(R&(RR=((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyR3ms
cC@st|d|�S(u�
    Change the user's Home Phone

    CLI Example:

    .. code-block:: bash

        salt '*' user.chhomephone foo "7735551234"
    u	homephone(R&(RR>((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyR4zs
cC@si}y�tj|�}|j|d<t|�|d<|j|d<|j|d<|j|d<|j|d<|j|d<|j	j
dd	�}x#t|�d
kr�|jd�q�W|d|d
<|d|d<|d|d<|d	|d<Wnt
k
r�iSX|S(un
    Return user information

    CLI Example:

    .. code-block:: bash

        salt '*' user.info root
    ugidugroupsuhomeunameupasswdushelluuidu,iiuiufullnameiu
roomnumberiu	workphoneu	homephone(R
Rtpw_gidRQtpw_dirRGt	pw_passwdtpw_shelltpw_uidRR
RRtKeyError(RRIR)R((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyR�s(







cC@stjjj|�S(u�
    Return a list of groups the named user belongs to

    CLI Example:

    .. code-block:: bash

        salt '*' user.list_groups foo
    (R'R(tusertget_group_list(R((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyRQ�s
cC@s&tgtj�D]}|j^q�S(ur
    Return a list of all users

    CLI Example:

    .. code-block:: bash

        salt '*' user.list_users
    (tsortedR
RFRG(R[((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt
list_users�s
cC@s�t|�}|s*tdj|���nt|�}|rTtdj|���ndd||g}td|dt�t|�jd�|kS(u�
    Change the username for a named user

    CLI Example:

    .. code-block:: bash

        salt '*' user.rename name new_name
    uUser '{0}' does not existuUser '{0}' already existsuusermodu-lucmd.runRuname(RRRRRR(Rtnew_nametcurrent_infotnew_infoR$((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pytrename�s
(,t__doc__t
__future__RRRR
RRtImportErrorRRtloggingtsalt.utils.dataR'tsalt.utils.usertsalt.extRtsalt.exceptionsRt	getLoggert__name__R,RR	RRR&R0RARDRJRKRLRMRORTR1R2R3R4RRQR^Rb(((s=/usr/lib/python2.7/site-packages/salt/modules/solaris_user.pyt<module>sX


	
			:			$!	
	
	
	
	"	
	

Zerion Mini Shell 1.0