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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddljjZddlmZddlZej�Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
  - Update ONTAP software
  - Requires an https connection and is not supported over http
extends_documentation_fragment:
  - netapp.na_ontap
module: na_ontap_software_update
options:
  state:
    choices: ['present', 'absent']
    description:
      - Whether the specified ONTAP package should update or not.
    default: present
  nodes:
    description:
      - List of nodes to be updated, the nodes have to be a part of a HA Pair.
    aliases:
      - node
  package_version:
    required: true
    description:
      - Specifies the package version to update software.
  package_url:
    required: true
    description:
      - Specifies the package URL to download the package.
  ignore_validation_warning:
    description:
      - Allows the update to continue if warnings are encountered during the validation phase.
    default: False
    type: bool
short_description: NetApp ONTAP Update Software
version_added: "2.7"
se

    - name: ONTAP software update
      na_ontap_software_update:
        state: present
        nodes: vsim1
        package_url: "{{ url }}"
        package_version: "{{ version_name }}"
        ignore_validation_warning: True
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"
t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppONTAPSoftwareUpdatecB`sqeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(s2
    Class with ONTAP software update methods
    cC`s,tj�|_|jjtdtdtdddddgdd�d	tdtdd
ddg�d
tdtdd�dtdtdd�dtdtdddt���td|jdt�|_t	�|_
|j
j|jj�|_
ttkr|jjdd�ntjd|j�|_dS(Ntstatetrequiredttypetstrtchoicestpresenttabsenttdefaulttnodestlisttaliasestnodetpackage_versiontpackage_urltignore_validation_warningtboolt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttFalsetTrueR	R Rt	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyt__init__Qs'	cC`sTtjjd�}tjjd�}tjjd�}|j|�|j|�|S(s�
        Compose NaElement object to query current version
        :return: NaElement object for cluster-image-get-iter with query
        scluster-image-get-itertqueryscluster-image-info(R!tzapit	NaElementtadd_child_elem(R/tcluster_image_getR1tcluster_image_info((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytcluster_image_get_iterhs

cC`s�|j�}y|jj|dt�}WnOtjjk
ry}|jjdd|j	dt
|�fdtj��nX|j
d�r�t|jd��dkr�tSdS(	sl
        Get current cluster image info
        :return: True if query successful, else return None
        tenable_tunnelingRs,Error fetching cluster image details: %s: %sRt	exceptionsnum-recordsiN(R7R.tinvoke_successfullyR&R!R2t
NaApiErrorR R,R*R
t	tracebackt
format_exctget_child_by_nametinttget_child_contenttNone(R/R7tresultterror((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyR5tscC`s�tjjd�}|jd|�y|jj|dt�WnHtjjk
r�}|jj	dd|t
|�fdtj��nXdS(s?
        Get current cluster image info for given node
        scluster-image-getsnode-idR8Rs/Error fetching cluster image details for %s: %sR9N(
R!R2R3t
add_new_childR.R:R&R;R R,R
R<R=(R/t	node_nameR5RC((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytcluster_image_get_for_node�scC`s
tjjd�}t�}y|jj|dt�}Wnstjjk
r�}t|j	�dkr�|j
jd�tkr�|S|jj
ddt|�dtj��nX|jd�jd	�r|jd�jd	�}|jd
�|d<|jd�|d
<n|S(s�
        Get current cluster image update progress info
        :return: Dictionary of cluster image update progress if query successful, else return None
        s"cluster-image-update-progress-infoR8sUnexpected errorthttpsRs8Error fetching cluster image update progress details: %sR9t
attributessndu-progress-infosoverall-statustoverall_statusscompleted-node-counttcompleted_node_count(R!R2R3R$R.R:R&R;R
tcodeR*tgetR R,R<R=R>R@(R/tcluster_update_progress_gettcluster_update_progress_infoRBRCtupdate_progress_info((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyt!cluster_image_update_progress_get�s 	-
cC`stjjd�}|jd|jd�|jdt|jd��|jjd�r�tjjd�}x%|jdD]}|jd|�qxW|j|�ny|jj	|dt
�WnOtjjk
r
}|jj
d	d
|jdt|�fdtj��nXdS(
s.
        Update current cluster image
        scluster-image-updatespackage-versionRsignore-validation-warningRRs	node-nameR8Rs'Error updating cluster image for %s: %sR9N(R!R2R3RDR*RRLR4R.R:R&R;R R,R
R<R=(R/tcluster_update_infot
cluster_nodesRRC((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytcluster_image_update�s	cC`s�tjjd�}|jd|jd�y|jj|dt�Wnhtjjk
r�}t	|j
�dkrttS|jjdd|jdt	|�fdt
j��nXtS(	s
        Get current cluster image package download
        :return: True if package already exists, else return False
        scluster-image-package-downloadspackage-urlRR8t18408Rs2Error downloading cluster image package for %s: %sR9(R!R2R3RDR*R.R:R&R;R
RKR R,R<R=R%(R/t#cluster_image_package_download_infoRC((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytcluster_image_package_download�scC`s�tjjd�}|jd|jd�y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXdS(	s6
        Delete current cluster image package
        scluster-image-package-deletespackage-versionRR8Rs/Error deleting cluster image package for %s: %sR9N(R!R2R3RDR*R.R:R&R;R R,R
R<R=(R/t!cluster_image_package_delete_infoRC((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytcluster_image_package_delete�scC`s�tjjd�}y|jj|dt�}WnOtjjk
r}|jjdd|j	dt
|�fdtj��nXt
�}|jd�r�|jd�|d<|jd	�|d
<|jd�|d<|Sd
S(s�
        Get current cluster image package download progress
        :return: Dictionary of cluster image download progress if query successful, else return None
        s#cluster-image-get-download-progressR8RsAError fetching cluster image package download progress for %s: %sRR9sprogress-statustprogress_statussprogress-detailstprogress_detailssfailure-reasontfailure_reasonN(R!R2R3R.R:R&R;R R,R*R
R<R=R$R>R@RA(R/t,cluster_image_package_download_progress_infoRBRCtcluster_download_progress_info((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyt'cluster_image_package_download_progress�s 				cC`sAtj|j�}tjd|jd|�}tjd|�dS(sF
        Autosupport log for software_update
        :return:
        R tvservertna_ontap_software_updateN(R!tget_cserverR.R-R t
ems_log_event(R/tresultstcserver((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytautosupport_log�scC`s�|jjd�tk	r.|jjdd�nt}|j�|j�}|jjd�r�x%|jdD]}|j|�qjWn|jjd�dkr�|r�|j	�}|tkrA|j
�}x2|jd�dkr�tjd	�|j
�}q�W|jd�d
kr#|j
�t}qQ|jjdd|d�n|j
�t}|j�}x9|s||jd
�dkr�tjd�|j�}q`W|jd
�dkr�|j�q�n|jjd|�dS(s7
        Apply action to update ONTAP software
        RGRshttps parameter must be TrueRR
RRYtasync_pkg_get_phase_runningitasync_pkg_get_phase_completesError downloading package: %sR[RItin_progressit	completedtchangedN(R*RLR&R R,R%ReR5RFRVR^ttimetsleepRSRPRXt	exit_json(R/RjtcurrentRtpackage_existstcluster_download_progresstcluster_update_progress((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytapplys:


	

(t__name__t
__module__t__doc__R0R7R5RFRPRSRVRXR^ReRr(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyRLs				
				
			cC`st�}|j�dS(sExecute actionN(RRr(t
community_obj((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pytmain&s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR<tansible.module_utils.basicR	tansible.module_utils._textR
tansible.module_utils.netapptmodule_utilstnetappR!t"ansible.module_utils.netapp_moduleRRkthas_netapp_libR+tobjectRRwRs(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_software_update.pyt<module>s$


%�	

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