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_ldap.pyc

�
�Udac@`s�dZddlmZmZmZeZidd6dgd6dd6Zd	Zd
Z	dZ
ddlZddlj
jZdd
lmZddlmZddlmZej�Zdefd��YZd�Zedkr�e�ndS(sw
(c) 2018-2019, NetApp, Inc
GNU General Public License v3.0+
(see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�

module: na_ontap_ldap

short_description: NetApp ONTAP LDAP
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.9'
author: Milan Zink (@zeten30) <[email protected]>/<[email protected]>

description:
- Create, modify or delete LDAP on NetApp ONTAP SVM/vserver

options:

  state:
    description:
    - Whether the LDAP is present or not.
    choices: ['present', 'absent']
    default: 'present'
    type: str

  vserver:
    description:
    - vserver/svm configured to use LDAP
    required: true
    type: str

  name:
    description:
    - The name of LDAP client configuration
    required: true
    type: str

  skip_config_validation:
    description:
    - Skip LDAP validation
    choices: ['true', 'false']
    type: str
s+

    - name: Enable LDAP on SVM
      na_ontap_ldap:
        state:         present
        name:          'example_ldap'
        vserver:       'vserver1'
        hostname:      "{{ netapp_hostname }}"
        username:      "{{ netapp_username }}"
        password:      "{{ netapp_password }}"

t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppOntapLDAPcB`sGeZdZd�Zdd�Zd�Zd�Zd�Zd�Z	RS(s&
    LDAP Client definition class
    cC`stj�|_|jjtdtdtdd�dtdtddddd	g�d
tdtdddgdd�d
tdtdd���td|jdt�|_	t
�|_|jj|j	j
�|_ttkr�|j	jdd�n%tjd|j	d
|jd
�|_dS(Ntnametrequiredttypetstrtskip_config_validationtdefaulttchoicesttruetfalsetstatetpresenttabsenttvservert
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttTruetFalsetNoneR	RRt	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pyt__init__Vs!!	
cC`stjjd�}|dkr.|jd}ntjjjdi|d6�}tjjd�}|j|�|j|�|jj|dt	�}d}|j
d�rt|jd��dkr|j
d	�}|j
d�}i|jd�d
6|jd�d6|jd
�d
6}n|S(s�
        Checks if LDAP config exists.

        :return:
            ldap config object if found
            None if not found
        :rtype: object/None
        sldap-config-get-iterR
sldap-configs
client-configtquerytenable_tunnelingsnum-recordsisattributes-listt
client_configsskip-config-validationRRN(
Rtzapit	NaElementR$R(tcreate_node_with_childrentadd_child_elemR,tinvoke_successfullyR"tget_child_by_nametinttget_child_content(R-tclient_config_nametconfig_infot
query_detailsR/tresulttconfig_detailstattributes_list((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytget_ldapls 


*cC`s�i|jdd6dd6}|jjd�dk	rG|jd|d<ntjjjd|�}y|jj|dt	�WnOtjj
k
r�}|jjd	d
|jdt
|�fdtj��nXdS(
s+
        Create LDAP configuration
        R
s
client-configRsclient-enabledRsskip-config-validationsldap-config-createR0Rs(Error creating LDAP configuration %s: %st	exceptionN(R(tgetR$RR2R3R4R,R6R"t
NaApiErrorRR*R
t	tracebackt
format_exc(R-toptionstldap_createterrcatch((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytcreate_ldap�s
)cC`s�tjjjdi�}y|jj|dt�WnOtjjk
r�}|jj	dd|j
dt|�fdtj
��nXdS(s+
        Delete LDAP configuration
        sldap-config-deleteR0Rs(Error deleting LDAP configuration %s: %sR
RAN(RR2R3R4R,R6R"RCRR*R(R
RDRE(R-tldap_client_deleteRH((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytdelete_ldap�scC`s�tjjd�}|jd|jd�x4|D],}|dkr0|jd|j|�q0q0Wy|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fd	tj
��nXd
S(sN
        Modify LDAP
        :param modify: list of modify attributes
        sldap-config-modifys
client-configR
Rsskip-config-validationR0RsError modifying LDAP %s: %sRAN(RR2R3t
add_new_childR(R,R6R"RCRR*R
RDRE(R-tmodifytldap_modifyt	attributeRH((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytmodify_ldap�s
)cC`s�|j�}|jj||j�}|jj||j�}tjd|j�|jjr�|j	j
rjq�|dkr�|j�q�|dkr�|j�q�|r�|j
|�q�n|j	jd|jj�dS(s%Call create/modify/delete operations.t
na_ontap_ldaptcreatetdeletetchangedN(R@R%t
get_cd_actionR(tget_modified_attributesRt
ems_log_eventR,RTRt
check_modeRIRKRPt	exit_json(R-tcurrentt	cd_actionRM((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytapply�s

N(
t__name__t
__module__t__doc__R.R$R@RIRKRPR\(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pyRQs	$			cC`st�}|j�dS(sONTAP LDAP client configurationN(RR\(t
ldapclient((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pytmain�s	t__main__(R_t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRDtansible.module_utils.netapptmodule_utilstnetappRtansible.module_utils.basicR	tansible.module_utils._textR
t"ansible.module_utils.netapp_moduleRthas_netapp_libR)tobjectRRaR](((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap.pyt<module>s$


)
�	

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