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/netapp_e_alerts.pyo

�
�Udac@`s	ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
ddlZdd
lmZddlmZmZddlmZidd6dd6Zdefd��YZd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_byst	
---
module: netapp_e_alerts
short_description: NetApp E-Series manage email notification settings
description:
    - Certain E-Series systems have the capability to send email notifications on potentially critical events.
    - This module will allow the owner of the system to specify email recipients for these messages.
version_added: '2.7'
author: Michael Price (@lmprice)
extends_documentation_fragment:
    - netapp.eseries
options:
    state:
        description:
            - Enable/disable the sending of email-based alerts.
        default: enabled
        required: false
        choices:
            - enabled
            - disabled
    server:
        description:
            - A fully qualified domain name, IPv4 address, or IPv6 address of a mail server.
            - To use a fully qualified domain name, you must configure a DNS server on both controllers using
             M(netapp_e_mgmt_interface).
             - Required when I(state=enabled).
        required: no
    sender:
        description:
            - This is the sender that the recipient will see. It doesn't necessarily need to be a valid email account.
            - Required when I(state=enabled).
        required: no
    contact:
        description:
            - Allows the owner to specify some free-form contact information to be included in the emails.
            - This is typically utilized to provide a contact phone number.
        required: no
    recipients:
        description:
            - The email addresses that will receive the email notifications.
            - Required when I(state=enabled).
        required: no
    test:
        description:
            - When a change is detected in the configuration, a test email will be sent.
            - This may take a few minutes to process.
            - Only applicable if I(state=enabled).
        default: no
        type: bool
    log_path:
        description:
            - Path to a file on the Ansible control node to be used for debug logging
        required: no
notes:
    - Check mode is supported.
    - Alertable messages are a subset of messages shown by the Major Event Log (MEL), of the storage-system. Examples
      of alertable messages include drive failures, failed controllers, loss of redundancy, and other warning/critical
      events.
    - This API is currently only supported with the Embedded Web Services API v2.0 and higher.
s"
    - name: Enable email-based alerting
      netapp_e_alerts:
        state: enabled
        sender: [email protected]
        server: [email protected]
        contact: "Phone: 1-555-555-5555"
        recipients:
            - [email protected]
            - [email protected]
        api_url: "10.1.1.1:8443"
        api_username: "admin"
        api_password: "myPass"

    - name: Disable alerting
      netapp_e_alerts:
        state: disabled
        api_url: "10.1.1.1:8443"
        api_username: "admin"
        api_password: "myPass"
sz
msg:
    description: Success message
    returned: on success
    type: str
    sample: The settings have been updated.
N(tpformat(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_nativesapplication/jsonsContent-TypetAccepttAlertscB`s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`s�t�}|jtdtdddtdddddg�d	tdddt�d
tdddt�dtdddt�dtdd
dt�dtdddtdt�dtdddt���ddd	d
dggg}td|dtd|�|_|jj}|ddk|_|d	|_	|d
|_
|d|_|d|_|d|_
|d|_|d|_td|dd|dd|d�|_|jj|_|d}tj|jj�|_|rtjdtjd|dddd �n|jjd!�s$|jd!7_ntjd"�}|j
rl|j|j
�rl|jjd#d$|j
�n|jdk	r�x:|jD]/}|j|�s�|jjd#d%|�q�q�Wt|j�d&kr�|jjd#d'�q�ndS((Ntstatettypetstrtrequiredtdefaulttenabledtchoicestdisabledtservertsendertcontactt
recipientstlistttesttbooltlog_patht
argument_spectsupports_check_modetrequired_iftssidtapi_urlturl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernametleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)st/s[^@]+@[^@]+\.[^@]+tmsgs6The sender (%s) provided is not a valid email address.s9The recipient (%s) provided is not a valid email address.is1At least one recipient address must be specified.( RtupdatetdicttFalseR	tTruetmoduletparamstalertsRRRRRR"turltcredst
check_modetloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtendswithtretcompiletmatcht	fail_jsontNonetlen(tselfRR!targsRtemailt	recipient((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pyt__init__ysT	








	
cC`s�yMt|jd|jdt|j�\}}|jjdt|��|SWn9tk
r�}|j	j
dd|jt|�f�nXdS(Ns storage-systems/%s/device-alertstheaderssCurrent config: %sR/sGFailed to retrieve the alerts configuration! Array Id [%s]. Error [%s].(R
R7R"tHEADERSR8R>tinfoRt	ExceptionR4RER(RHtrctresultterr((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pytget_configuration�scC`s|j�}t}t�}|jrGtdt�}|dsFt}n|jd|j�|d|jkrut}n|jd|jdt�|jr�|j|dks�|dr�t}n|jd|j�|d|jkr�t}n|j	j
�|dr|dj
�n|jd|j	�|d|j	krit}qin"|dritdt�}t}n|jjt
|��|r|jryEt|jd|jdd	d
tj|�dt|j�\}}Wqtk
r}|jjdd
|jt|�f�qXn|S(NtalertingEnabledtemailServerAddresstadditionalContactInformationt sendAdditionalContactInformationtemailSenderAddresstrecipientEmailAddressess storage-systems/%s/device-alertstmethodtPOSTtdataRMR/sDWe failed to set the storage-system name! Array Id [%s]. Error [%s].(RTR2R1R6R3R0RRRRtsortR>tdebugRR9R
R7R"tjsontdumpsRNR8RPR4RER(RHtconfigR0tbodyRQRRRS((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pytupdate_configuration�sF		
				


	(c	C`s�|js�yst|jd|jdddddt|j�\}}|ddkr{|jjd	d
|d|jf�nWq�tk
r�}|jjd	d|jt	|�f�q�XndS(
sTSend a test email to verify that the provided configuration is valid and functional.s1storage-systems/%s/device-alerts/alert-email-testttimeouti,R[R\RMtresponsetemailSentOKR/s6The test email failed with status=[%s]! Array Id [%s].s<We failed to send the test email! Array Id [%s]. Error [%s].N(
R9R
R7R"RNR8R4RERPR(RHRQRRRS((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pytsend_test_email�s	!cC`s}|j�}|jr8|r8|jjd�|j�n|jrZd|j|jf}nd}|jj	d|d|�dS(Ns5An update was detected and test=True, running a test.s5Alerting has been enabled using server=%s, sender=%s.sAlerting has been disabled.R/tchanged(
RdRR>RORhR6RRR4t	exit_json(RHR0R/((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pyR0s
	cO`s|j�dS(N(R0(RHRItkwargs((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pyt__call__s(R=t
__module__RLRTRdRhR0Rl(((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pyRxs	=		/		cC`st�}|�dS(N(R(R6((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pytmains	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR`R:tpprintRRBtansible.module_utils.basicR	tansible.module_utils.netappR
Rtansible.module_utils._textRRNtobjectRRnR=(((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_alerts.pyt<module>s*


=
�	

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