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

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

module: na_ontap_license

short_description: NetApp ONTAP protocol and feature licenses
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.6'
author: NetApp Ansible Team (@carchi8py) <[email protected]>

description:
- Add or remove licenses on NetApp ONTAP.

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

  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.

  license_names:
    description:
    - List of license-names to delete.
    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

  license_codes:
    description:
    - List of license codes to be added.

s
- name: Add licenses
  na_ontap_license:
    state: present
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    serial_number: #################
    license_codes: CODE1,CODE2

- name: Remove licenses
  na_ontap_license:
    state: absent
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    remove_unused: false
    remove_expired: true
    serial_number: #################
    license_names: nfs,cifs
s

N(t
AnsibleModule(t	to_nativecC`s7g|D] }||||kr|^q}t|�S(s�
        compares with only values and not keys, keys should be the same for both dicts
        :param a: dict 1
        :param b: dict 2
        :return: difference of values in both dicts
        (tlen(tatbtkeytdiff((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pyt	local_cmp�s-tNetAppOntapLicensecB`sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(sONTAP license classcC`swtj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdddd�dtdddd�d
tdddd�dtdddd���td|jdtdddddgfg�|_|jj	}|d|_
|d|_|d
|_|d|_
|d
|_|d|_ttkr[|jjdd�ntjd|j�|_dS(Ntstatetrequiredtchoicestpresenttabsenttdefaultt
serial_numberttypetstrt
remove_unusedtbooltremove_expiredt
license_codestlistt
license_namest
argument_spectsupports_check_modetrequired_iftmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specR tupdatetdicttFalsetNoneRR$tparamsRRRRRRtHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tselft
parameters((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pyt__init__�s0	






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_tunnelingR#s!Error checking license status: %st	exceptionslicense-v2-statustpackagetmethodN(R%tzapit	NaElementR*R/tinvoke_successfullyR)t
NaApiErrorR$R-R	t	tracebackt
format_exctget_child_by_nametget_childrentget_child_content(	R0tlicense_statustresultterrortreturn_dictionarytlicense_v2_statustlicense_v2_status_infoR5R((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytget_licensing_status�s"		
cC`s�tjjd�}|jd|j�|jd|�y|jj|dt�tSWn[tjj	k
r�}t
|j�dkr�tS|jj
ddt
|�dtj��nXd	S(
su
        Remove requested licenses
        :param:
          package_name: Name of the license to be deleted
        slicense-v2-deletes
serial-numberR5R3t15661R#sError removing license %sR4N(R%R7R8t
add_new_childRR/R9R)tTrueR:R	tcodeR$R-R;R<(R0tpackage_nametlicense_deleteRB((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytremove_licenses�scC`sutjjd�}y|jj|dt�WnBtjjk
rp}|jjddt	|�dt
j��nXdS(s(
        Remove unused licenses
        slicense-v2-delete-unusedR3R#s"Error removing unused licenses: %sR4N(R%R7R8R/R9R)R:R$R-R	R;R<(R0RRB((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytremove_unused_licenses�scC`sutjjd�}y|jj|dt�WnBtjjk
rp}|jjddt	|�dt
j��nXdS(s)
        Remove expired licenses
        slicense-v2-delete-expiredR3R#s#Error removing expired licenses: %sR4N(R%R7R8R/R9R)R:R$R-R	R;R<(R0RRB((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytremove_expired_licenses�s		cC`s�tjjd�}tjjd�}x3|jD](}|jdt|j�j���q.W|j|�y|j	j
|dt�WnBtjjk
r�}|j
jddt|�dtj��nXdS(	s
        Add licenses
        slicense-v2-addtcodesslicense-code-v2R3R#sError adding licenses: %sR4N(R%R7R8RRHRtstriptlowertadd_child_elemR/R9R)R:R$R-R	R;R<(R0tlicense_addRPRJRB((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytadd_licensess&
c
C`s�t}t}t}tj|j�}tjd|jd|�}tjd|�|j�}|jdkrst	}nZ|j
dk	r�t	}t	}n|jdk	r�t	}t	}n|j
dk	r�t	}t	}n|r�|jdkri|r�|j�n|jdk	r|j�n|j
dk	r-|j�n|s9|r�|j�}t||�dkrft}qfq�q�t}x-|jD]}	||j|	�O}|}qyWn|jjd|�dS(	s"Call add, delete or modify methodsR$tvservertna_ontap_licenseRRitchangedN(R)R%tget_cserverR/R.R$t
ems_log_eventRFRRIRR*RRRURNRORRRMt	exit_json(
R0RXtcreate_licensetremove_licensetresultstcserverR@tnew_license_statustlicense_deletedR5((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytapplysH					



(
t__name__t
__module__t__doc__R2RFRMRNRORURb(((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pyR�s	 				
	cC`st�}|j�dS(sApply license operationsN(RRb(tobj((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pytmain?s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR;tansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappR%thas_netapp_libR,RtobjectRRgRc(((sS/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_license.pyt<module>s"


Y	�	

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