Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyc

�
�Udac@`s+ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZyTddlmZddlmZddlmZddlmZddlmZWnaek
rAddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ defd��YZ!de"fd ��YZ#d!e"fd"��YZ$d#e"fd$��YZ%d%�Z&e'd&kr'e&�ndS('i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_software_image
short_description: Manage software images on a BIG-IP
description:
  - Manages software images on a BIG-IP. These images may include both base images
    and hotfix images.
version_added: 2.7
options:
  force:
    description:
      - When C(yes), will upload the file every time and replace the file on the
        device.
      - When C(no), the file will only be uploaded if it does not already
        exist.
      - Generally should be C(yes) only in cases where you have reason
        to believe that the image was corrupted during upload.
    type: bool
    default: no
  state:
    description:
      - When C(present), ensures that the image is uploaded.
      - When C(absent), ensures that the image is removed.
    type: str
    choices:
      - absent
      - present
    default: present
  image:
    description:
      - The image to put on the remote device.
      - This may be an absolute or relative location on the Ansible controller.
      - Image names, whether they are base ISOs or hotfix ISOs, B(must) be unique.
    type: str
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s�
- name: Upload relative image to the BIG-IP
  bigip_software_image:
    image: BIGIP-13.0.0.0.0.1645.iso
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Upload absolute image to the BIG-IP
  bigip_software_image:
    image: /path/to/images/BIGIP-13.0.0.0.0.1645.iso
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Upload image in a role to the BIG-IP
  bigip_software_image:
    image: "{{ role_path }}/files/BIGIP-13.0.0.0.0.1645.iso"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s\
image_type:
  description: Whether the image is a release or hotfix image
  returned: changed
  type: str
  sample: release
version:
  description: Version of the software contained in the image.
  returned: changed
  type: str
  sample: 13.1.0.8
build:
  description: Build version of the software contained in the image.
  returned: changed
  type: str
  sample: 0.0.3
checksum:
  description: MD5 checksum of the ISO.
  returned: changed
  type: str
  sample: 8cdbd094195fab4b2b47ff4285577b70
file_size:
  description: Size of the uploaded image in MB.
  returned: changed
  type: int
  sample: 1948
N(turlparse(t
AnsibleModule(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tupload_filet
ParameterscB`s6eZidd6ZgZdddddgZgZRS(t	file_sizetfileSizet
image_typetversiontbuildtchecksum(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR�s
	t
ApiParameterscB`seZed��ZRS(cC`s;|jddkrdS|jdjd�}t|d�S(NRt i(t_valuestNonetsplittint(tselfttmp((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR�s(RRtpropertyR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR�stModuleParameterscB`seZed��ZRS(cC`stjj|j�S(N(tostpathtbasenametimage(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pytfilename�s(RRR$R*(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR%�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R"tresultt
returnable((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt	to_return�s
(RRR1(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR+�st
UsableChangescB`seZRS((RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR2�stReportableChangescB`seZRS((RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR3�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R"R5R6((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R,tAttributeErrort_Difference__default(R"tparamR/((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R,R5R6R8(R"R:tattr1tattr2((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt	__default�s
N(RRRR7R;R9(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR4�s	t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(cO`sp|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_d|_d|_
dS(Ntmoduletparams(tgetRR@R
RAtclientR%R5RR6R2tchangesRt	image_url(R"targstkwargs((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR7�s	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRA(RRR,R5RR2RD(R"tchangedtkey((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt_set_changed_options�scC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRA(R4R5R6RRtdictR;Rt
isinstancetupdateR2RDtTruetFalse(R"tdiffRRHtktchange((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RSRNRO(R"R/((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRARH(RORKR5tstateRURVR3RDR1RMt_announce_deprecations(R"RHR/RWt
reportableRD((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgR(tpopRCR@t	deprecate(R"R/twarningstwarning((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRX
s


cC`s$|j�r|j�S|j�SdS(N(texistsRMtcreate(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRUs
cC`s |j�s|j�rtStS(N(timage_existst
hotfix_existsRNRO(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRascC`sCt|d�j}dj|jjd|jjd|�|_dS(NtselfLinkshttps://{0}:{1}{2}tservertserver_port(RR'tformatRCtproviderRE(R"titemR'((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt_set_image_url s


cC`s�t}dj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rx}tt	|���nXd|kr�xN|dD]?}|dj
|jj�r�|j
|�d|_t}Pq�q�Wn|S(Ns+https://{0}:{1}/mgmt/tm/sys/software/image/RfRgtitemstnametrelease(RORhRCRitapiRBtjsont
ValueErrorRtstrt
startswithR5R*RkRRN(R"R/turitresptresponsetexRj((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRc(s"

	cC`s�t}dj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rx}tt	|���nXd|kr�xN|dD]?}|dj
|jj�r�|j
|�d|_t}Pq�q�Wn|S(Ns,https://{0}:{1}/mgmt/tm/sys/software/hotfix/RfRgRlRmthotfix(RORhRCRiRoRBRpRqRRrRsR5R*RkRRN(R"R/RtRuRvRwRj((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRd>s"

	cC`s8|jjrtS|jjr4|j�|j�tStS(N(R@t
check_modeRNR5tforcetremove_from_devicetcreate_on_deviceRO(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRMTs

cC`sa|jjrtS|j�x4tdd�D]#}|j�s@tStjd�q*Wtd��dS(NiiisFailed to delete the resource.(	R@RyRNR{trangeRattimetsleepR(R"tx((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pytremove^s
cC`s�|j�|jjrtS|j�xMtdd�D]<}|j�rc|j�|_|j�tSt	j
d�q4Wtd��dS(NiiisFailed to create the resource.(RJR@RyRNR|R}Ratread_current_from_deviceR5R~RR(R"R�((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRbms


cC`sgdj|jjd|jjd�}yt|j||jj�Wntk
rbtd��nXdS(Ns9https://{0}:{1}/mgmt/cm/autodeploy/software-image-uploadsRfRgsFailed to upload the file.(RhRCRiRR5R)R(R"turl((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR|�s

cC`s�|jjj|j�}y|j�}Wn%tk
rO}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j��nt	d|�}|j
i|jd6�|S(Ntcodei�i�tmessageRAR(i�i�(RCRoRBRERpRqRRrtcontentRRMR(R"RuRvRwR/((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR��scC`s|j�r|j�StS(N(RaR�RO(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyRV�s
cC`s<|j�r|jd�n|j�r8|jd�ndS(NR)Rx(Rctremove_iso_from_deviceRd(R"((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR{�scC`s�dj|jjd|jjd||jj�}|jjj|�}|jdkrZtSd|kr�|dd	kr�d|kr�t	|d��q�t	|j
��ndS(
Ns,https://{0}:{1}/mgmt/tm/sys/software/{2}/{3}RfRgi�R�i�i�R�(i�i�(RhRCRiR5R*RotdeleteRRNRR�(R"ttypeRtRv((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR��s

(RRR7RJRSRTRZRXRURaRkRcRdRMR�RbR|R�RVR{R�(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR?�s&													
						tArgumentSpeccB`seZd�ZRS(cC`sxt|_tdtdd�dtdt�dtddd	dd
g��}i|_|jjt�|jj|�dS(NRzR�tboolR)trequiredRWtdefaultRUtchoicesRV(RNtsupports_check_modeRKt
argument_specRMR
(R"R�((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR7�s		(RRR7(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�R@R\(
R�R	R�R�R?RZt	exit_jsonRt	fail_jsonRr(tspecR@tmmtresultsRw((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pytmain�s		t__main__((t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR&R~tansible.module_utils.urlsRtansible.module_utils.basicR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
t(library.module_utils.network.f5.icontrolRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRRR%R+R2R3tobjectR4R?R�R�R(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_software_image.pyt<module>sF


'
	�	

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