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_cdot_license.pyo

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

module: na_cdot_license

short_description: Manage NetApp cDOT protocol and feature licenses
extends_documentation_fragment:
    - netapp.ontap
version_added: '2.3'
author: Sumit Kumar (@timuster) <[email protected]>

deprecated:
  removed_in: '2.11'
  why: Updated modules released with increased functionality
  alternative: Use M(na_ontap_license) instead.

description:
- Add or remove licenses on NetApp ONTAP.

options:

  remove_unused:
    description:
    - Remove licenses that have no controller affiliation in the cluster.
    type: bool

  remove_expired:
    description:
    - Remove licenses that have expired in the cluster.
    type: bool

  serial_number:
    description:
    - Serial number of the node associated with the license.
    - This parameter is used primarily when removing license for a specific service.
    - If this parameter is not provided, the cluster serial number is used by default.

  licenses:
    description:
    - List of licenses to add or remove.
    - Please note that trying to remove a non-existent license will throw an error.
    suboptions:
      base:
        description:
          - Cluster Base License
      nfs:
        description:
          - NFS License
      cifs:
        description:
          - CIFS License
      iscsi:
        description:
          - iSCSI License
      fcp:
        description:
          - FCP License
      cdmi:
        description:
          - CDMI License
      snaprestore:
        description:
          - SnapRestore License
      snapmirror:
        description:
          - SnapMirror License
      flexclone:
        description:
          - FlexClone License
      snapvault:
        description:
          - SnapVault License
      snaplock:
        description:
          - SnapLock License
      snapmanagersuite:
        description:
          - SnapManagerSuite License
      snapprotectapps:
        description:
          - SnapProtectApp License
      v_storageattach:
        description:
          - Virtual Attached Storage License

s�
- name: Add licenses
  na_cdot_license:
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    serial_number: #################
    licenses:
      nfs: #################
      cifs: #################
      iscsi: #################
      fcp: #################
      snaprestore: #################
      flexclone: #################

- name: Remove licenses
  na_cdot_license:
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    remove_unused: false
    remove_expired: true
    serial_number: #################
    licenses:
      nfs: remove
s

N(t
AnsibleModule(t	to_nativetNetAppCDOTLicensecB`sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`stj�|_|jjtdtdtdddd�dtdtdd�dtdtdd�d	tdtdd
���td|jdt�|_|jj	}|d|_
|d|_|d|_|d	|_
ttkr�|jjd
d�ntjd|j�|_dS(Nt
serial_numbertrequiredttypetstrtdefaultt
remove_unusedtbooltremove_expiredtlicensestdictt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstontap_sf_host_argument_specRtupdateRtFalsetNoneRRtparamsRRRRtHAS_NETAPP_LIBt	fail_jsontsetup_ontap_zapitserver(tselftp((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pyt__init__�s"	



c	C`s�tjjd�}d	}y|jj|dt�}WnBtjjk
rx}|jj	ddt
|�dtj��nXi}|j
d�}|r�x?|j�D].}|jd�}|jd�}|||<q�Wn|S(
s�
            Check licensing status

            :return: package (key) and licensing status (value)
            :rtype: dict
        slicense-v2-status-list-infotenable_tunnelingRs!Error checking license status: %st	exceptionslicense-v2-statustpackagetmethodN(Rtzapit	NaElementRR"tinvoke_successfullyRt
NaApiErrorRR R	t	tracebackt
format_exctget_child_by_nametget_childrentget_child_content(	R#tlicense_statustresulttetreturn_dictionarytlicense_v2_statustlicense_v2_status_infoR(R((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytget_licensing_status�s 
cC`s�tjjd�}x|D]}|jd|�qW|jdk	rX|jd|j�ny|jj|dt�WnBtjj	k
r�}|j
jddt|�dt
j��nXdS(	sq
        Remove requested licenses
        :param:
            remove_list : List of packages to remove

        slicense-v2-deleteR(s
serial-numberR&RsError removing license %sR'N(RR*R+t
add_new_childRRR"R,RR-RR R	R.R/(R#tremove_listtlicense_deleteR(R5((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytremove_licenses�s
cC`sutjjd�}y|jj|dt�WnBtjjk
rp}|jjddt	|�dt
j��nXdS(s(
        Remove unused licenses
        slicense-v2-delete-unusedR&Rs"Error removing unused licenses: %sR'N(RR*R+R"R,RR-RR R	R.R/(R#RR5((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytremove_unused_licenses�scC`sutjjd�}y|jj|dt�WnBtjjk
rp}|jjddt	|�dt
j��nXdS(s)
        Remove expired licenses
        slicense-v2-delete-expiredR&Rs#Error removing expired licenses: %sR'N(RR*R+R"R,RR-RR R	R.R/(R#RR5((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytremove_expired_licenses�scC`s�|jr|j�n|jr,|j�ntjjd�}tjjd�}g}x||jj�D]k\}}t	|�}|rf|j
�rf|j�dkr�|jt	|�j��q�|j
d|�qfqfWt|�dkr�|j|�nt|j��dkr~|j|�y|jj|dt�Wq~tjjk
rz}|jjddt|�d	tj��q~Xnd
S(s!
        Update licenses
        slicense-v2-addtcodestremoveslicense-code-v2iR&RsError adding licenses: %sR'N(RR>RR?RR*R+RtitemsRtstriptlowertappendR:tlenR=R1tadd_child_elemR"R,RR-RR R	R.R/(R#tlicense_addR@R;tkeytvaluet	str_valueR5((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytupdate_licenses�s.	
	

cC`sTt}|j�}|j�|j�}||kr=t}n|jjd|�dS(Ntchanged(RR9RLtTrueRt	exit_json(R#RMR3tnew_license_status((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytapplys
	(	t__name__t
__module__R%R9R=R>R?RLRQ(((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pyR
�s						&cC`st�}|j�dS(N(R
RQ(tv((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pytmain%s	t__main__(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR.tansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappRthas_netapp_libRtobjectR
RURR(((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_na_cdot_license.pyt<module>s 


W�	

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