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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZmZddlmZidd6dd6Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysN
---
module: netapp_e_iscsi_target
short_description: NetApp E-Series manage iSCSI target configuration
description:
    - Configure the settings of an E-Series iSCSI target
version_added: '2.7'
author: Michael Price (@lmprice)
extends_documentation_fragment:
    - netapp.eseries
options:
    name:
        description:
            - The name/alias to assign to the iSCSI target.
            - This alias is often used by the initiator software in order to make an iSCSI target easier to identify.
        aliases:
            - alias
    ping:
        description:
            - Enable ICMP ping responses from the configured iSCSI ports.
        type: bool
        default: yes
    chap_secret:
        description:
            - Enable Challenge-Handshake Authentication Protocol (CHAP), utilizing this value as the password.
            - When this value is specified, we will always trigger an update (changed=True). We have no way of verifying
              whether or not the password has changed.
            - The chap secret may only use ascii characters with values between 32 and 126 decimal.
            - The chap secret must be no less than 12 characters, but no greater than 57 characters in length.
            - The chap secret is cleared when not specified or an empty string.
        aliases:
            - chap
            - password
    unnamed_discovery:
        description:
            - When an initiator initiates a discovery session to an initiator port, it is considered an unnamed
              discovery session if the iSCSI target iqn is not specified in the request.
            - This option may be disabled to increase security if desired.
        type: bool
        default: yes
    log_path:
        description:
            - A local path (on the Ansible controller), to a file to be used for debug logging.
        required: no
notes:
    - Check mode is supported.
    - Some of the settings are dependent on the settings applied to the iSCSI interfaces. These can be configured using
      M(netapp_e_iscsi_interface).
    - This module requires a Web Services API version of >= 1.3.
s�
    - name: Enable ping responses and unnamed discovery sessions for all iSCSI ports
      netapp_e_iscsi_target:
        api_url: "https://localhost:8443/devmgr/v2"
        api_username: admin
        api_password: myPassword
        ssid: "1"
        validate_certs: no
        name: myTarget
        ping: yes
        unnamed_discovery: yes

    - name: Set the target alias and the CHAP secret
      netapp_e_iscsi_target:
        ssid: "{{ ssid }}"
        api_url: "{{ netapp_api_url }}"
        api_username: "{{ netapp_api_username }}"
        api_password: "{{ netapp_api_password }}"
        name: myTarget
        chap: password1234
s�
msg:
    description: Success message
    returned: on success
    type: str
    sample: The iSCSI target settings have been updated.
alias:
    description:
        - The alias assigned to the iSCSI target.
    returned: on success
    sample: myArray
    type: str
iqn:
    description:
        - The iqn (iSCSI Qualified Name), assigned to the iSCSI target.
    returned: on success
    sample: iqn.1992-08.com.netapp:2800.000a132000b006d2000000005a0e8f45
    type: str
N(tpformat(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_nativesapplication/jsonsContent-TypetAccepttIscsiTargetcB`sDeZd�Zed��Zd�Zd�Zd�Zd�ZRS(cC`s~t�}|jtdtdddtddg�dtdddtd	t�d
tdddtdddgd
t�dtdddtd	t�dtdddt���td|dt�|_|jj}|d|_|d|_	|d
|_
|d|_|d|_|d|_
td|dd|dd|d�|_|jj|_t�|_t�|_|d}tj|jj�|_|r�tjdtjd|dddd�n|j
jd�s�|j
d7_
n|j
rzt|j
�d kst|j
�d!kr)|jjd"d#�nxN|j
D]@}t|�}|d$ks]|d%kr3|jjd"d&�q3q3WndS('Ntnamettypetstrtrequiredtaliasestaliastpingtbooltdefaulttchap_secrettchaptpasswordtno_logtunnamed_discoverytlog_patht
argument_spectsupports_check_modetssidtapi_urlturl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernametleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)st/ii9tmsgsYThe provided CHAP secret is not valid, it must be between 12 and 57 characters in length.i i~ssThe provided CHAP secret is not valid, it may only utilize ascii characters with decimal values between 32 and 126.(RtupdatetdicttFalsetTrueR	tmoduletparamsRRRRR turltcredst
check_modet	post_bodytlisttcontrollerstloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtendswithtlent	fail_jsontord(tselfRtargsRtctordinal((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyt__init__ysH	'







	
	*cC`sit�}y t|jd|jdt|j�\}}|s[|jjdd|j�n|d}tg|ddD]}|dd	krw|^qw�}|j	td
|d
dd|d
dd	|��t|jd|jdt|j�\}}|d}|j	td|dd|d��Wn9t
k
rd}|jjdd|jt|�f�nX|S(s-Provide information on the iSCSI Target configuration

        Sample:
        {
          'alias': 'myCustomName',
          'ping': True,
          'unnamed_discovery': True,
          'chap': False,
          'iqn': 'iqn.1992-08.com.netapp:2800.000a132000b006d2000000005a0e8f45',
        }
        sEstorage-systems/%s/graph/xpath-filter?query=/storagePoolBundle/targettheadersR-sKThis storage-system doesn't appear to have iSCSI interfaces. Array Id [%s].itconfiguredAuthMethodstauthMethodDatat
authMethodRRt
iscsiAliastiqntnodeNamet
iscsiNodeNames?storage-systems/%s/graph/xpath-filter?query=/sa/iscsiEntityDataRticmpPingResponseEnabledRtunnamedDiscoverySessionsEnabledsKFailed to retrieve the iSCSI target information. Array Id [%s]. Error [%s].(R/R
R4R tHEADERSR5R2RCtanyR.t	ExceptionR(REttargettrctdatatauthRterr((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyRW�s.
	 
4
 
cC`s:t}|j}t�}|jdk	rP|j|dkrPt}|j|d<n|jr�t}|jtdtd|j��n)|dr�t}|jtdt��n|r6|jr6y=t	|j
d|jdddtj
|�d	t|j�Wq6tk
r2}|jjd
d|jt|�f�q6Xn|S(
s/Update the iSCSI target alias and CHAP settingsRtenableChapAuthenticationt
chapSecretRs(storage-systems/%s/iscsi/target-settingstmethodtPOSTRYRJR-sFFailed to update the iSCSI target settings. Array Id [%s]. Error [%s].N(R0RWR/RtNoneR1RR.R6R
R4R tjsontdumpsRTR5RVR2RCR(RER.RWtbodyR[((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pytapply_iscsi_settings�s,		"	
 cC`st}|j}t�}|j|dkrAt}|j|d<n|j|dkrjt}|j|d<n|jjt|��|r|j	ryCt
|jd|jdddt
j|�d	d
dt|j�Wqtk
r}|jjdd
|jt|�f�qXn|S(NRRRRRSsstorage-systems/%s/iscsi/entityR^R_RYttimeouti<RJR-sFFailed to update the iSCSI target settings. Array Id [%s]. Error [%s].(R0RWR/RR1RR>tinfoRR6R
R4R RaRbRTR5RVR2RCR(RER.RWRcR[((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pytapply_target_changes�s&		&c`sc|j�}|j�p|}|j�t�fd��D��}|jjddd||�dS(Nc3`s+|]!}|dkr|�|fVqdS(RORN(siqnsalias((t.0tkey(RW(sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pys	<genexpr>sR-s)The interface settings have been updated.tchanged(RdRgRWR/R2t	exit_json(RER.RY((RWsX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyR.s
	cO`s|j�dS(N(R.(RERFtkwargs((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyt__call__s(	R=t
__module__RItpropertyRWRdRgR.Rm(((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyRxs	4-	 			cC`st�}|�dS(N(R(tiface((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pytmain s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRaR:tpprintRtansible.module_utils.basicR	tansible.module_utils.netappR
Rtansible.module_utils._textRRTtobjectRRqR=(((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_iscsi_target.pyt<module>s(


3
�	

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