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

�
�Udac@`sEddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZydddlmZddlmZddlmZddlmZddlmZddlmZWnqek
rqddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZ defd��YZ!defd��YZ"de"fd��YZ#de"fd ��YZ$d!e%fd"��YZ&d#e%fd$��YZ'd%�Z(e)d&krAe(�ndS('i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_lx_package
short_description: Manages Javascript LX packages on a BIG-IP
description:
  - Manages Javascript LX packages on a BIG-IP. This module will allow
    you to deploy LX packages to the BIG-IP and manage their lifecycle.
version_added: 2.5
options:
  package:
    description:
      - The LX package that you want to upload or remove. When C(state) is C(present),
        and you intend to use this module in a C(role), it is recommended that you use
        the C({{ role_path }}) variable. An example is provided in the C(EXAMPLES) section.
      - When C(state) is C(absent), it is not necessary for the package to exist on the
        Ansible controller. If the full path to the package is provided, the filename will
        specifically be cherry picked from it to properly remove the package.
    type: path
  state:
    description:
      - Whether the LX package should exist or not.
    type: str
    default: present
    choices:
      - present
      - absent
notes:
  - Requires the rpm tool be installed on the host. This can be accomplished through
    different ways on each platform. On Debian based systems with C(apt);
    C(apt-get install rpm). On Mac with C(brew); C(brew install rpm).
    This command is already present on RedHat based systems.
  - Requires BIG-IP >= 12.1.0 because the required functionality is missing
    on versions earlier than that.
  - The module name C(bigip_iapplx_package) has been deprecated in favor of C(bigip_lx_package).
requirements:
  - Requires BIG-IP >= 12.1.0
  - The 'rpm' tool installed on the Ansible controller
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s�
- name: Install AS3
  bigip_lx_package:
    package: f5-appsvcs-3.5.0-3.noarch.rpm
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Add an LX package stored in a role
  bigip_lx_package:
    package: "{{ roles_path }}/files/MyApp-0.1.0-0001.noarch.rpm'"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove an LX package
  bigip_lx_package:
    package: MyApp-0.1.0-0001.noarch.rpm
    state: absent
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s
# only common fields returned
N(t
AnsibleModule(turlparse(tLooseVersion(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttmos_version(tupload_filet
ParameterscB`sPeZgZgZed��Zed��Zed��Zed��ZRS(cC`s"|jddkrdS|jdS(Ntpackage(t_valuestNone(tself((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRwscC`s.|jddkrdStjj|jd�S(NR(RRtostpathtbasename(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pytpackage_file}scC`sJdddd|jg}|jj|�\}}}|sFt|j�S|S(sReturn a valid name for the package

        BIG-IP determines the package name by the content of the RPM info.
        It does not use the filename. Therefore, we do the same. This method
        is only used though when the file actually exists on your Ansible
        controller.

        If the package does not exist, then we instead use the filename
        portion of the 'package' argument that is provided.

        Non-existence typically occurs when using 'state' = 'absent'

        :return:
        trpms-qps
--queryformats%%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}(Rt_moduletrun_commandtstrR(Rtcmdtrctoutterr((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pytpackage_name�s

cC`sJ|jddkrdStjj|jd�}tjj|�}|dS(NRi(RRRRRtsplitext(Rtbasetresult((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pytpackage_root�s
(	t__name__t
__module__tapi_attributestreturnablestpropertyRRR"R&(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRsst
ApiParameterscB`seZRS((R'R((((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR,�stModuleParameterscB`seZRS((R'R((((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR-�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R*tgetattrt_filter_paramst	Exception(RR%t
returnable((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyt	to_return�s
(R'R(R3(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR.�st
UsableChangescB`seZRS((R'R((((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR4�stReportableChangescB`seZRS((R'R((((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR5�st
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(cO`s[|jdd�|_t|jj�|_td|jd|jj�|_t�|_	dS(Ntmoduletparams(
tgetRR7RR8tclientR-twantR4tchanges(Rtargstkwargs((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyt__init__�s!cC`s�t�}t}|jj}t|j�}t|�td�krQtd��n|dkrl|j�}n|dkr�|j	�}n|j
j�}|j|�|jtd|��|S(Ns12.0.0s(This version of BIG-IP is not supported.tpresenttabsenttchanged(
tdicttFalseR;tstateRR:R
RR@RAR<R3tupdate(RR%RBREtversionR<((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pytexec_module�s	
cC`s|j�rtS|j�SdS(N(texistsRDtcreate(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR@�scC`s%t}|j�r!|j�}n|S(N(RDRItremove(RRB((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRA�scC`s9|jjrtS|j�|j�r5td��ntS(Ns Failed to delete the LX package.(R7t
check_modetTruetremove_from_deviceRIR(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRK�s
cC`s�|jjrtStjj|jj�sy|jjjd�r[t	dj
|jj���qyt	dj
tj����n|j�|j
�|j�|j�|j�r�tSt	d��dS(Nt/s.The specified LX package was not found at {0}.s.The specified LX package was not found in {0}.sFailed to install LX package.(R7RLRMRRRIR;Rt
startswithRtformattgetcwdtupload_to_devicetcreate_on_devicetenable_iapplx_on_devicetremove_package_file_from_device(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRJ�s



cC`s�t}|j�}tjj|jj�r3t}nxK|D]C}|rc|jj|dkr}tSq:|jj	|dkr:tSq:WtS(NtpackageName(
RDt get_installed_packages_on_deviceRRRIR;RRMR"R&(RRItpackagesR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRIs	
cC`sdj|jjd|jjd�}tdd�}|jjj|d|�}y|j�}Wn%tk
r�}tt	|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j
��nt|d�j}|j
|�}|dd
kr|dStd��dS(Ns9https://{0}:{1}/mgmt/shared/iapp/package-management-taskstservertserver_portt	operationtQUERYtjsontcodei�i�tmessagetselfLinkRtFINISHEDt
queryResponses4Failed to find the installed packages on the device.(i�i�(RQR:tproviderRCtapitpostR^t
ValueErrorRRtcontentR	Rt_wait_for_task(RturiR8tresptresponsetexRttask((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRXs&
cC`sTd}xGtdd�D]6}|j|�}|ddkr?|Stjd�qW|S(Nii<RRbtFAILEDi(sFINISHEDRo(Rtrangetcheck_task_on_devicettimetsleep(RRRntx((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRi-scC`s�dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
ru}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��n|S(Nshttps://{0}:{1}{2}RZR[R_i�R`(
RQR:RdReR9R^RgRRRh(RRRjRkRlRm((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRq6s

	cC`sgdj|jjd|jjd�}yt|j||jj�Wntk
rbtd��nXdS(Ns1https://{0}:{1}/mgmt/shared/file-transfer/uploadsRZR[sFailed to upload the file.(RQR:RdRR;RR(Rturl((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRSJs

cC`s�tddddj|jj��}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd	|kr�|d	d
kr�d|kr�t
|d��q�t
|j��ndS(NtcommandtruntutilCmdArgss/var/config/rest/downloads/{0}s$https://{0}:{1}/mgmt/tm/util/unix-rmRZR[R^R_i�i�R`(i�i�(
RCRQR;RR:RdReRfR^RgRRRh(RR8RjRkRlRm((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRVVs
c	C`s:dj|jj�}tddd|�}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd	|kr�|d	dkr�d|kr�t
|d��q�t
|j��nt
|d
�j}|j|�}|ddkr&tSt
|d��dS(Ns/var/config/rest/downloads/{0}R\tINSTALLtpackageFilePaths9https://{0}:{1}/mgmt/shared/iapp/package-management-tasksRZR[R^R_i�i�R`RaRRbterrorMessage(i�i�(RQR;RRCR:RdReRfR^RgRRRhR	RRiRM(	Rtremote_pathR8RjRkRlRmRRn((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRTjs(
cC`stddd|jj�}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��nt
|d�j}|j|�}|d
dkrtStS(NR\t	UNINSTALLRWs9https://{0}:{1}/mgmt/shared/iapp/package-management-tasksRZR[R^R_i�i�R`RaRRb(i�i�(RCR;R&RQR:RdReRfR^RgRRRhR	RRiRMRD(RR8RjRkRlRmRRn((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRN�s(
cC`s�tdddd�}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%tk
r�}tt	|���nXd	|kr�|d	d
kr�d|kr�t|d��q�t|j
��ndS(NRvRwRxs(-c "touch /var/config/rest/iapps/enable"s!https://{0}:{1}/mgmt/tm/util/bashRZR[R^R_i�i�R`(i�i�(RCRQR:RdReRfR^RgRRRh(RR8RjRkRlRm((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyRU�s	
(R'R(R?RHR@RARKRJRIRXRiRqRSRVRTRNRU(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR6�s															tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdddddg�dtdd��}i|_|jjt�|jj|�dddggg|_dS(	NREtdefaultR@tchoicesRARttypeR(RMtsupports_check_modeRCt
argument_specRFRtrequired_if(RR�((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR?�s		(R'R(R?(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyR~�scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�R7tmsg(R~RR�R�R�R6RHt	exit_jsonRt	fail_jsonR(tspecR7tmmtresultsRm((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pytmain�s			t__main__(*t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRRrtansible.module_utils.basicRtansible.module_utils.urlsR	tdistutils.versionR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
Rt(library.module_utils.network.f5.icontrolRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRR,R-R.R4R5tobjectR6R~R�R'(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_lx_package.pyt<module>sJ


+
/�	

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