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

�
�Udac@`s�dZddlmZmZmZeZidd6dgd6dd6Zd	Zd
Z	dZ
ddlZdd
lm
Z
ddlmZddljjZddlmZej�Zdefd��YZd�Zedkr�e�ndS(s8
create Autosupport module to enable, disable or modify
i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bysX
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
  - "Enable/Disable Autosupport"
extends_documentation_fragment:
  - netapp.na_ontap
module: na_ontap_autosupport
options:
  state:
    description:
    - Specifies whether the AutoSupport daemon is present or absent.
    - When this setting is absent, delivery of all AutoSupport messages is turned off.
    choices: ['present', 'absent']
    default: present
  node_name:
    description:
    - The name of the filer that owns the AutoSupport Configuration.
    required: true
  transport:
    description:
    - The name of the transport protocol used to deliver AutoSupport messages
    choices: ['http', 'https', 'smtp']
  noteto:
    description:
    - Specifies up to five recipients of short AutoSupport e-mail messages.
  post_url:
    description:
    - The URL used to deliver AutoSupport messages via HTTP POST
  mail_hosts:
    description:
    - List of mail server(s) used to deliver AutoSupport messages via SMTP.
    - Both host names and IP addresses may be used as valid input.
  support:
    description:
    - Specifies whether AutoSupport notification to technical support is enabled.
    type: bool
  from_address:
    description:
    - specify the e-mail address from which the node sends AutoSupport messages
    version_added: 2.8
  partner_addresses:
    description:
    - Specifies up to five partner vendor recipients of full AutoSupport e-mail messages.
    version_added: 2.8
  to_addresses:
    description:
    - Specifies up to five recipients of full AutoSupport e-mail messages.
    version_added: 2.8
  proxy_url:
    description:
    - specify an HTTP or HTTPS proxy if the 'transport' parameter is set to HTTP or HTTPS and your organization uses a proxy.
    - If authentication is required, use the format "username:password@host:port".
    version_added: 2.8
  hostname_in_subject:
    description:
    - Specify whether the hostname of the node is included in the subject line of the AutoSupport message.
    type: bool
    version_added: 2.8
short_description: NetApp ONTAP Autosupport
version_added: "2.7"

s�
    - name: Enable autosupport
      na_ontap_autosupport:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        state: present
        node_name: test
        transport: https
        noteto: [email protected],[email protected]
        mail_hosts: 1.2.3.4,5.6.7.8
        support: False
        post_url: url/1.0/post

    - name: Modify autosupport proxy_url with password
      na_ontap_autosupport:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        state: present
        node_name: test
        transport: https
        proxy_url: username:[email protected]:8000

    - name: Modify autosupport proxy_url without password
      na_ontap_autosupport:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        state: present
        node_name: test
        transport: https
        proxy_url: [email protected]:8000

    - name: Disable autosupport
      na_ontap_autosupport:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        state: absent
        node_name: test

t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppONTAPasupcB`sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sClass with autosupport methodscC`s�tj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdtdd	dddd
g�dtdtdd�dtdtdd	�dtdtdd�dtdtdd�dtdtdd	�dtdtdd�dtdtdd�dtdtdd	�dtdtdd���td|jdt�|_t	�|_
|j
j|jj�|_
|j
ddkr�dnd|j
d<|j�ttkr�|jjdd�ntjd |j�|_dS(!Ntstatetrequiredtchoicestpresenttabsenttdefaultt	node_namettypetstrt	transporttsmtpthttpthttpstnotetotlisttpost_urltsupporttboolt
mail_hoststfrom_addresstpartner_addressestto_addressest	proxy_urlthostname_in_subjectt
argument_spectsupports_check_modetstartedtstoppedt
service_statetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specR%tupdatetdicttFalsetTrueR	R+Rt	na_helpertset_parameterstparamst
parameterstset_playbook_zapi_key_maptHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pyt__init__�s0!$	&
cC`suidd6dd6dd6dd6dd	6|j_idd
6dd6dd6dd6|j_idd6dd6|j_dS(Ns	node-nameRRspost-urlRtfromR s	proxy-urlR#Rsmail-addresss
mail-hostststringRspartner-addressR!ttoR"sis-support-enabledRsis-node-in-subjectR$(snotetosmail-address(s
mail-hostssstring(spartner-addresssmail-address(R?smail-address(R2tzapi_string_keystzapi_list_keystzapi_bool_keys(R;((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pyR6�sc
C`s�tjjd�}|jd|jd�t�}y|jj|dt�}WnBtjj	k
r�}|j
jddt|�dt
j��nX|jd�jd	�}|d
dkr�dnd
|d<x.|jjj�D]\}}||||<q�WxC|jjj�D]/\}}|jjdtd||�||<qWxT|jjj�D]@\}}|\}}	|jjdtd|j|��||<qUW|S(sW
        Invoke zapi - get current autosupport details
        :return: dict()
        sautosupport-config-gets	node-nameRtenable_tunnelingR*s%st	exceptiont
attributessautosupport-config-infos
is-enabledttrueR'R(R)t	from_zapitvaluetzapi_parent(R,tzapit	NaElementt
add_new_childR5R/R:tinvoke_successfullyR1t
NaApiErrorR+R8R
t	tracebackt
format_exctget_child_by_nameR2R@titemsRBtget_value_for_boolRAtget_value_for_list(
R;tasup_detailst	asup_infotresultterrortasup_attr_infotitem_keytzapi_keytparenttdummy((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pytget_autosupport_config�s(	 c	C`s�i|jdd6}|jd�rK|jd�dkr>dnd|d<ntjjd�}x�|D]�}||jjkr�|jjj|�}||||<qd||jjkr�|jjj|�}|jjd	t	d
||�||<qd||jj
krd|jj
j|�\}}|j|jjd	t	d|d|d
|j|���qdqdW|j
|�y|jj|dt�SWnBtjjk
r�}|jjddt|�dtj��nXdS(s{
        Invoke zapi - modify autosupport config
        @return: NaElement object / FAILURE with an error_message
        Rs	node-nameR)R'RFtfalses
is-enabledsautosupport-config-modifyRGRHRIt
zapi_childtdataRCR*s%sRDN(R5tgetR,RJRKR2R@RBRSR0RAtadd_child_elemRTttranslate_structR:RMR1RNR+R8R
RORP(	R;tmodifyRUtasup_configRZR[t
parent_keyt	child_keyRX((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pytmodify_autosupport_config�s.(

cC`sAtj|j�}tjd|jd|�}tjd|�dS(NR+tvservertna_ontap_autosupport(R,tget_cserverR:R9R+t
ems_log_event(R;tresultstcserver((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pytautosupport_log�scC`sl|j�}|jj||j�}|jjrO|jjr?qO|j|�n|jjd|jj�dS(s-
        Apply action to autosupport
        tchangedN(	R^R2tget_modified_attributesR5RqR+t
check_modeRit	exit_json(R;tcurrentRe((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pytapply�s(	t__name__t
__module__t__doc__R<R6R^RiRpRv(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pyR�s	"				cC`st�}|j�dS(sExecute actionN(RRv(tasup_obj((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pytmains	t__main__(Ryt
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNROtansible.module_utils.basicR	tansible.module_utils._textR
tansible.module_utils.netapptmodule_utilstnetappR,t"ansible.module_utils.netapp_moduleRthas_netapp_libR7tobjectRR{Rw(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_autosupport.pyt<module>s$


@,�	

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