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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZmZddlmZidd6dd6Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysZ
---
module: netapp_e_syslog
short_description: NetApp E-Series manage syslog settings
description:
    - Allow the syslog settings to be configured for an individual E-Series storage-system
version_added: '2.7'
author: Nathan Swartz (@ndswartz)
extends_documentation_fragment:
    - netapp.eseries
options:
    state:
        description:
            - Add or remove the syslog server configuration for E-Series storage array.
            - Existing syslog server configuration will be removed or updated when its address matches I(address).
            - Fully qualified hostname that resolve to an IPv4 address that matches I(address) will not be
              treated as a match.
        choices:
            - present
            - absent
        default: present
    address:
        description:
            - The syslog server's IPv4 address or a fully qualified hostname.
            - All existing syslog configurations will be removed when I(state=absent) and I(address=None).
    port:
        description:
            - This is the port the syslog server is using.
        default: 514
    protocol:
        description:
            - This is the transmission protocol the syslog server's using to receive syslog messages.
        choices:
            - udp
            - tcp
            - tls
        default: udp
    components:
        description:
            - The e-series logging components define the specific logs to transfer to the syslog server.
            - At the time of writing, 'auditLog' is the only logging component but more may become available.
        default: ["auditLog"]
    test:
        description:
            - This forces a test syslog message to be sent to the stated syslog server.
            - Only attempts transmission when I(state=present).
        type: bool
        default: no
    log_path:
        description:
            - This argument specifies a local path for logging purposes.
        required: no
notes:
    - Check mode is supported.
    - This API is currently only supported with the Embedded Web Services API v2.12 (bundled with
      SANtricity OS 11.40.2) and higher.
s�
    - name: Add two syslog server configurations to NetApp E-Series storage array.
      netapp_e_syslog:
        state: present
        address: "{{ item }}"
        port: 514
        protocol: tcp
        component: "auditLog"
        api_url: "10.1.1.1:8443"
        api_username: "admin"
        api_password: "myPass"
      loop:
        - "192.168.1.1"
        - "192.168.1.100"
s$
msg:
    description: Success message
    returned: on success
    type: str
    sample: The settings have been updated.
syslog:
    description:
        - True if syslog server configuration has been added to e-series storage array.
    returned: on success
    sample: True
    type: bool
N(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_nativesapplication/jsonsContent-TypetAccepttSyslogcB`sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`set�}|jtdtdddgdtdd�dtdd	dt�d
tdddddt�d
tddddgdddt�dtdddtddg�dtdddtdt�dtdd	dt���dddd
d
dggg}ddgg}td|dtd|d|�|_|jj}|dd)k|_|d|_	|d
|_
|d
|_|d|_|d|_
|d|_|d|_td|dd|dd |d!�|_|jj�|jj|_|d}tj|jj�|_|r=tjd"tjd#|d$d%d&d'�n|jjd(�sa|jd(7_ndS(*Ntstatetchoicestpresenttabsenttrequiredtdefaulttaddressttypetstrtporttintitprotocolttcpttlstudpt
componentstlisttauditLogttesttbooltlog_patht
argument_spectsupports_check_modetrequired_iftmutually_exclusivetssidtapi_urlturl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernametleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)st/(R(R
tupdatetdicttFalseRtTruetmoduletparamstsyslogRRRRR R'turltcredstsortt
check_modetloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtendswith(tselfR#R%R&targsR"((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyt__init__tsF	!$









	
cC`syy9t|jdj|j�dt|j�\}}|SWn9tk
rt}|jjdd|jt	|�f�nXdS(s'Retrieve existing syslog configuration.sstorage-systems/{0}/syslogtheaderstmsgsCFailed to retrieve syslog configuration! Array Id [%s]. Error [%s].N(
R	R;R2R'tHEADERSR<t	ExceptionR8t	fail_jsonR(RGtrctresultterr((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pytget_configuration�scC`s�yBt|jdj|j|d�dddt|j�\}}Wn;tk
r}|jjddj|jt	|���nXdS(	s�Send test syslog message to the storage array.

        Allows fix number of retries to occur before failure is issued to give the storage array time to create
        new syslog server record.
        s#storage-systems/{0}/syslog/{1}/testtidtmethodtPOSTRJRKs<We failed to send test message! Array Id [{0}]. Error [{1}].N(
R	R;R2R'RLR<RMR8RNR(RGtbodyRORPRQ((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyttest_configuration�s#c

C`s4d}d}t}t�}|j�}|jr�x�|D]�}|d|jkr7|}|d|jkr�|d|jkr�t|d�t|j�kr�t	g|dD]}|d|jk^q��r�|}Pq�q7q7Wn|j
r�|s0t}|r|jtd|d��ng|jD]}td|�^q!}	|jtd|jd|jd|jd|	��|j
j|�|j|�q0n�|jr�t}|jtd|d��|j
j|�|j|�nW|r0t}xH|D]=}|jtd|d��|j
j|�|j|�q�Wn|S(s!Post the syslog request to array.t
serverAddressRRRRRSN(tNoneR6R5RRRRRtlenRtallR:R7R4RCtinfotmake_configuration_request(
RGtconfig_matcht
perfect_matchR4RVtconfigstconfigt	componenttcomponent_typeR((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pytupdate_configuration�sH		
&0	%	
c	C`sq|jsmy%|jr�d|krqt|jdj|j|d�dddtj|�dt|j	�\}}nSt|jdj|j�dddtj|�dt|j	�\}}|j
|�|jr-|j|�q-nMd|kr-t|jdj|j|d�dddt|j	�\}}nWqmt
k
ri}|jjd	d
|jt|�f�qmXndS(NRSsstorage-systems/{0}/syslog/{1}RTRUtdataRJsstorage-systems/{0}/syslogtDELETERKsDWe failed to modify syslog configuration! Array Id [%s]. Error [%s].(R>R:R	R;R2R'tjsontdumpsRLR<R4R RWRMR8RNR(RGRVRORPRQ((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyR]�s$		 -*
	#"cC`s)|j�}|jjddd|�dS(s,Update configuration and respond to ansible.RKs&The syslog settings have been updated.tchangedN(RdR8t	exit_json(RGR4((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyR4	scO`s|j�dS(N(R4(RGRHtkwargs((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyt__call__s(	RBt
__module__RIRRRWRdR]R4Rl(((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyR
ss	3	
	
	0		cC`st�}|�dS(N(R
(tsettings((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pytmains	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRgR?tansible.module_utils.basicRtansible.module_utils.netappR	R
tansible.module_utils._textRRLtobjectR
RoRB(((sR/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_syslog.pyt<module>s&


:
�	

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