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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
d
efd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysG
---
module: netapp_e_hostgroup
version_added: "2.2"
short_description: NetApp E-Series manage array host groups
author:
    - Kevin Hulquest (@hulquest)
    - Nathan Swartz (@ndswartz)
description: Create, update or destroy host groups on a NetApp E-Series storage array.
extends_documentation_fragment:
    - netapp.eseries
options:
    state:
        required: true
        description:
            - Whether the specified host group should exist or not.
        choices: ["present", "absent"]
    name:
        required: false
        description:
            - Name of the host group to manage
            - This option is mutually exclusive with I(id).
    new_name:
        required: false
        description:
            - Specify this when you need to update the name of a host group
    id:
        required: false
        description:
            - Host reference identifier for the host group to manage.
            - This option is mutually exclusive with I(name).
    hosts:
        required: false
        description:
            - List of host names/labels to add to the group
s3
    - name: Configure Hostgroup
      netapp_e_hostgroup:
        ssid: "{{ ssid }}"
        api_url: "{{ netapp_api_url }}"
        api_username: "{{ netapp_api_username }}"
        api_password: "{{ netapp_api_password }}"
        validate_certs: "{{ netapp_api_validate_certs }}"
        state: present
s
clusterRef:
    description: The unique identification value for this object. Other objects may use this reference value to refer to the cluster.
    returned: always except when state is absent
    type: str
    sample: "3233343536373839303132333100000000000000"
confirmLUNMappingCreation:
    description: If true, indicates that creation of LUN-to-volume mappings should require careful confirmation from the end-user, since such a mapping
                 will alter the volume access rights of other clusters, in addition to this one.
    returned: always
    type: bool
    sample: false
hosts:
    description: A list of the hosts that are part of the host group after all operations.
    returned: always except when state is absent
    type: list
    sample: ["HostA","HostB"]
id:
    description: The id number of the hostgroup
    returned: always except when state is absent
    type: str
    sample: "3233343536373839303132333100000000000000"
isSAControlled:
    description: If true, indicates that I/O accesses from this cluster are subject to the storage array's default LUN-to-volume mappings. If false,
                 indicates that I/O accesses from the cluster are subject to cluster-specific LUN-to-volume mappings.
    returned: always except when state is absent
    type: bool
    sample: false
label:
    description: The user-assigned, descriptive label string for the cluster.
    returned: always
    type: str
    sample: "MyHostGroup"
name:
    description: same as label
    returned: always except when state is absent
    type: str
    sample: "MyHostGroup"
protectionInformationCapableAccessMethod:
    description: This field is true if the host has a PI capable access method.
    returned: always except when state is absent
    type: bool
    sample: true
(tNetAppESeriesModule(t	to_nativetNetAppESeriesHostGroupcB`s}eZdZdZd�Zed��Zed��Zed��Zdd�Z
ed�Zd�Z
d	�Zd
�ZRS(i
icC`sd}tdtdtdddgdd�d	tdtdd�d
tdtdd�dtdtdd�dtdtdd
��}d	dgg}tt|�jd|d|dtd|�|jj}|d|_|d	|_	|d
|_
|d|_|d|_d|_dS(Ns02.00.0000.0000tstatetrequiredtchoicestpresenttabsentttypetstrtnametnew_nametidthoststlisttansible_optionstweb_services_versiontsupports_check_modetmutually_exclusive(tdicttTruetFalsetsuperR
t__init__tmoduletparamsRRRRt
hosts_listtNonetcurrent_host_group(tselftversionRRtargs((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pyRss&!




cC`s�g}g}|jr�y |jd|j�\}}Wn9tk
rp}|jjdd|jt|�f�nXxz|jD]l}xc|D];}||dks�||dkr�|j|d�Pq�q�W|jjdd|j|f�q{Wn|S(sWRetrieve a list of host reference identifiers should be associated with the host group.sstorage-systems/%s/hoststmsgs@Failed to retrieve hosts information. Array id [%s].  Error[%s].RRs8Expected host does not exist. Array id [%s].  Host [%s].(R"trequesttssidt	ExceptionR t	fail_jsonR	tappend(R%t	host_listtexisting_hoststrcterrorthostt
existing_host((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pyR�s 	 
 cC`sg}g}y<|jd|j�\}}|jd|j�\}}Wn9tk
r�}|jjdd|jt|�f�nXg|D]"}i|dd6|dd6^q�}xa|D]Y}g}x6|D].}|d|dkr�|j|d�q�q�W|ji|d	6�q�W|S(
s(Retrieve a list of existing host groups.sstorage-systems/%s/host-groupssstorage-systems/%s/hostsR(sEFailed to retrieve host group information. Array id [%s].  Error[%s].t
clusterRefRRthostRefR(R)R*R+R R,R	R-tupdate(R%thost_groupsRR0R1tgroupt	hosts_idsR2((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pyR7�s  /

cC`scg}xV|jD]K}|jr2|d|jksN|jr|d|jkr|d}qqW|S(sARetrieve the current hosts associated with the current hostgroup.RRR(R7RR(R%t
current_hostsR8((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytcurrent_hosts_in_host_group�s
8c	C`s�|d
kr|jd}nx�|D]~}y9|jd|j|fdddidd6�\}}Wq#tk
r�}|jjdd	|j|t|�f�q#Xq#Wd
S(sUnassign hosts from host group.Rs storage-systems/%s/hosts/%s/movetmethodtPOSTtdatat(0000000000000000000000000000000000000000R8R(sSFailed to unassign hosts from host group. Array id [%s].  Host id [%s].  Error[%s].N(R#R$R)R*R+R R,R	(R%R.thost_idR0trespR1((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytunassign_hosts�s
 cC`s�|r|j�ny3|jd|j|jdfdd�\}}Wn9tk
r�}|jjdd|jt|�f�nXdS(sDelete host groups!storage-systems/%s/host-groups/%sRR<tDELETER(s7Failed to delete host group. Array id [%s].  Error[%s].N(RBR)R*R$R+R R,R	(R%RBR0RAR1((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytdelete_host_group�s
 cC`s�i|jd6|jd6}d	}y,|jd|jddd|�\}}Wn9tk
r�}|jjdd|jt|�f�nX|S(
sCreate host group.RRsstorage-systems/%s/host-groupsR<R=R>R(s7Failed to create host group. Array id [%s].  Error[%s].N(	RRR#R)R*R+R R,R	(R%R>tresponseR0R1((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytcreate_host_group�s,cC`s�i|jr|jn|jd6|jd6}|j}x0|jD]%}||kr?|j|g�q?q?Wd
}y9|jd|j|jdfddd|�\}}Wn9t	k
r�}|j
jdd	|jt|�f�nX|S(sUpdate host group.RRs!storage-systems/%s/host-groups/%sRR<R=R>R(s7Failed to create host group. Array id [%s].  Error[%s].N(
RRRR;RBR#R)R*R$R+R R,R	(R%R>tdesired_host_idsR2tupdate_responseR0R1((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytupdate_host_group�s
		0c
C`s�t}xU|jD]J}|jr2|d|jksN|jr|d|jkr||_qqW|jdkr�|jr�|jr�|j|jks�|j|jdkr�t}q�q�|js�|j	j
dd|j�nt}n|jr�t}nd}|r�|j	jr�d}|jdkr}|jrn|jrF|j|jks\|j|jdkrz|j
�}qzq�|j�}q�|jr�|j�d	|j|jd|jdf}q�n|j	jd|d
|�dS(s4Apply desired host group state to the storage array.RRRRR(sOThe option name must be supplied when creating a new host group. Array id [%s].tsNo changes required.sBHost group deleted. Array Id [%s].  Host Name [%s].  Host Id [%s].tchangedN(RR7RRR$RRRRR R,R*t
check_modeRIRFRDt	exit_json(R%tchanges_requiredR8R(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytapply�s88	1						
'N(t__name__t
__module__tEXPANSION_TIMEOUT_SECt$DEFAULT_DISK_POOL_MINIMUM_DISK_COUNTRtpropertyRR7R;R#RBRRDRFRIRO(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pyR
os	

	
	cC`st�}|j�dS(N(R
RO(t	hostgroup((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pytmain(s	t__main__N(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.netappRtansible.module_utils._textR	R
RVRP(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_hostgroup.pyt<module>s


&
,�	

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