Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddljjZddlmZej�Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys

module: na_ontap_unix_user

short_description: NetApp ONTAP UNIX users
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.8'
author: NetApp Ansible Team (@carchi8py) <[email protected]>

description:
- Create, delete or modify UNIX users local to ONTAP.

options:

  state:
    description:
    - Whether the specified user should exist or not.
    choices: ['present', 'absent']
    default: 'present'

  name:
    description:
    - Specifies user's UNIX account name.
    - Non-modifiable.
    required: true

  group_id:
    description:
    - Specifies the primary group identification number for the UNIX user
    - Required for create, modifiable.

  vserver:
    description:
    - Specifies the Vserver for the UNIX user.
    - Non-modifiable.
    required: true

  id:
    description:
    - Specifies an identification number for the UNIX user.
    - Required for create, modifiable.

  full_name:
    description:
    - Specifies the full name of the UNIX user
    - Optional for create, modifiable.
sL

    - name: Create UNIX User
      na_ontap_unix_user:
        state: present
        name: SampleUser
        vserver: ansibleVServer
        group_id: 1
        id: 2
        full_name: Test User
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"

    - name: Delete UNIX User
      na_ontap_unix_user:
        state: absent
        name: SampleUser
        vserver: ansibleVServer
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"

s

N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppOntapUnixUsercB`sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s6
    Common operations to manage users and roles.
    cC`s9tj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdtdd�dtdtdd�d
tdtdd	�dtdtdd	���td|jdt�|_t	�|_
|j
j|jj�|_
ttkr|jjdd�n%tjd|jd|j
d�|_dS(Ntstatetrequiredtchoicestpresenttabsenttdefaulttnamettypetstrtgroup_idtinttidt	full_nametvservert
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttFalsetTrueRRR
t	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyt__init__ks !	cC`s.tjjd�}iii|jdd6|jdd6d6d6}|j|�y�|jj|dt�}|jd�r�t	|j
d��d	kr�|d
d}it	|d�d6t	|d
�d6|dd6SdSWnOtjjk
r)}|j
jdd|jdt|�fdtj��nXdS(s�
        Checks if the UNIX user exists.

        :return:
            dict() if user found
            None if user is not found
        sname-mapping-unix-user-get-iterRs	user-nameRsunix-user-infotquerytenable_tunnelingsnum-recordsisattributes-listsgroup-idRsuser-idRs	full-nameRRsError getting UNIX user %s: %st	exceptionN(Rtzapit	NaElementR'ttranslate_structR+tinvoke_successfullyR#tget_child_by_nameRtget_child_contenttNonet
NaApiErrorRR)R	t	tracebackt
format_exc(R,t
get_unix_usert
attributestresultt	user_infoterror((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyR;�s$	
*)cC`s6|jjd�dks0|jjd�dkrF|jjdd�ntjjjdi|jdd6t	|jd�d6t	|jd�d	6�}|jjd
�dk	r�|j
d|jd
�ny|jj|dt
�WnOtjjk
r1}|jjdd
|jdt|�fdtj��nXdS(sV
        Creates an UNIX user in the specified Vserver

        :return: None
        RRRsIError: Missing one or more required parameters for create: (group_id, id)sname-mapping-unix-user-createRs	user-namesgroup-idsuser-idRs	full-nameR/sError creating UNIX user %s: %sR0N(R'tgetR7RR)RR1R2tcreate_node_with_childrenRt
add_new_childR+R4R#R8R	R9R:(R,tuser_createR?((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytcreate_unix_user�s0)cC`s�tjjjdi|jdd6�}y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXdS(	sL
        Deletes an UNIX user from a vserver

        :return: None
        sname-mapping-unix-user-destroyRs	user-nameR/RsError removing UNIX user %s: %sR0N(RR1R2RAR'R+R4R#R8RR)R	R9R:(R,tuser_deleteR?((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytdelete_unix_user�s)cC`stjjjdi|jdd6�}x�|D]{}|dkr\|jdt|d��n|dkr�|jdt|d��n|dkr-|jd	|d�q-q-Wy|jj|d
t	�WnOtjj
k
r}|jjdd|jdt
|�fd
tj��nXdS(Nsname-mapping-unix-user-modifyRs	user-nameRsgroup-idRsuser-idRs	full-nameR/Rs Error modifying UNIX user %s: %sR0(RR1R2RAR'RBRR+R4R#R8RR)R	R9R:(R,R&tuser_modifytkeyR?((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytmodify_unix_user�s
)cC`stjd|j�dS(sK
          Autosupport log for unix_user
          :return: None
          tna_ontap_unix_userN(Rt
ems_log_eventR+(R,((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytautosupport_log�scC`s�|j�|j�}|jj||j�}|jddkrh|dkrh|jj||j�}n|jjr�|jj	r�q�|dkr�|j
�q�|dkr�|j�q�|j|�n|jj
d|jj�dS(s_
        Invoke appropriate action based on playbook parameters

        :return: None
        RRtcreatetdeletetchangedN(RLR;R$t
get_cd_actionR'R7tget_modified_attributesRORt
check_modeRDRFRIt	exit_json(R,tcurrentt	cd_actiontmodify((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytapply�s


(
t__name__t
__module__t__doc__R-R;RDRFRIRLRW(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyRfs						cC`st�}|j�dS(N(RRW(tobj((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pytmain�s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR9tansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappRt"ansible.module_utils.netapp_moduleR
thas_netapp_libR(tobjectRR\RX(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyt<module>s"


2�	

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