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_nvme.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	certifiedtsupported_bysU
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
  - Create/Delete NVMe Service
extends_documentation_fragment:
  - netapp.na_ontap
module: na_ontap_nvme
options:
  state:
    choices: ['present', 'absent']
    description:
      - Whether the specified NVMe should exist or not.
    default: present
  vserver:
    description:
      - Name of the vserver to use.
    required: true
  status_admin:
    description:
      - Whether the status of NVMe should be up or down
    type: bool
short_description: "NetApp ONTAP Manage NVMe Service"
version_added: "2.8"
s�

    - name: Create NVMe
      na_ontap_nvme:
        state: present
        status_admin: False
        vserver: "{{ vserver }}"
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"

    - name: Modify NVMe
      na_ontap_nvme:
        state: present
        status_admin: True
        vserver: "{{ vserver }}"
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"

    - name: Delete NVMe
      na_ontap_nvme:
        state: absent
        vserver: "{{ vserver }}"
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppONTAPNVMecB`sGeZdZd�Zd�Zd�Zd�Zdd�Zd�Z	RS(s)
    Class with NVMe service methods
    cC`stj�|_|jjtdtdtdddddgdd�d	tdtdd�d
tdtdd���td|jd
t�|_t	�|_
|j
j|jj�|_
ttkr�|jjdd�n%tjd|jd	|j
d	�|_dS(Ntstatetrequiredttypetstrtchoicestpresenttabsenttdefaulttvservertstatus_admintboolt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttFalsetTrueR	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_nvme.pyt__init__Ts'	cC`stjjd�}iii|jdd6d6d6}|j|�y|jj|dt�}WnBtjjk
r�}|j	j
ddt|�dtj
��nX|jd	�rt|jd	��d
kr|jd�}|jd�}i|jd�d
6}|SdS(s_
        Get current nvme details
        :return: dict if nvme exists, None otherwise
        s
nvme-get-iterRsnvme-target-service-infotquerytenable_tunnelingRsError fetching nvme info: %st	exceptionsnum-recordsisattributes-listsis-availableRN(Rtzapit	NaElementR%ttranslate_structR)tinvoke_successfullyR t
NaApiErrorRR'R
t	tracebackt
format_exctget_child_by_nametinttget_child_contenttNone(R*tnvme_getR,tresultterrortattributes_listt	nvme_infotreturn_value((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytget_nvmejs"
*cC`s�tjjd�}|jjd�d	k	rNi|jdd6}|j|�ny|jj|dt	�WnOtjj
k
r�}|jjdd|jdt
|�fdtj��nXd	S(
s%
        Create NVMe service
        snvme-createRsis-availableR-Rs&Error creating nvme for vserver %s: %sRR.N(RR/R0R%tgetR9R1R)R2R!R3RR'R
R4R5(R*tnvme_createtoptionsR<((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytcreate_nvme�scC`s�tjjd�}y|jj|dt�WnOtjjk
r}}|jjdd|j	dt
|�fdtj��nXdS(s%
        Delete NVMe service
        snvme-deleteR-Rs&Error deleting nvme for vserver %s: %sRR.N(
RR/R0R)R2R!R3RR'R%R
R4R5(R*tnvme_deleteR<((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytdelete_nvme�scC`s�|d	kr|jd}ni|d6}tjjd�}|j|�y|jj|dt�WnOtjj	k
r�}|j
jdd|jdt|�fdt
j��nXd	S(
s%
        Modify NVMe service
        Rsis-availablesnvme-modifyR-Rs'Error modifying nvme for vserver %s: %sRR.N(R9R%RR/R0R1R)R2R!R3RR'R
R4R5(R*RRCtnvme_modifyR<((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytmodify_nvme�s

cC`s<tjd|j�|j�}|jj||j�}|jjd�d	k	r�|jj	t
|jd�|jd<|d	kr�|jddkr�|jj||j�}q�n|jjr|j
jr�q|dkr�|j�q|dkr	|jd�|j�q|r|j�qn|j
jd|jj�d	S(
s.
        Apply action to NVMe service
        t
na_ontap_nvmeRR
RtcreatetdeletetfalsetchangedN(Rt
ems_log_eventR)R@R"t
get_cd_actionR%RAR9tget_value_for_boolR tget_modified_attributesRMRt
check_modeRDRHRFt	exit_json(R*tcurrentt	cd_actiontmodify((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytapply�s$#


N(
t__name__t
__module__t__doc__R+R@RDRFR9RHRW(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pyROs				cC`st�}|j�dS(sExecute actionN(RRW(t
community_obj((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pytmain�s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR4tansible.module_utils.basicR	tansible.module_utils._textR
tansible.module_utils.netapptmodule_utilstnetappRt"ansible.module_utils.netapp_moduleRthas_netapp_libR&tobjectRR\RX(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_nvme.pyt<module>s"


{	

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