
    Vh{                     z    d dl mZmZmZ eZdZdZdZd dl	Z	d dl
Z
d dlmZ dZd Zd	 Zd
 Zd Zedk(  r e        yy)    )absolute_importdivisionprint_functiona  
module: jboss
short_description: Deploy applications to JBoss
description:
  - Deploy applications to JBoss standalone using the filesystem.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  deployment:
    required: true
    description:
      - The name of the deployment.
    type: str
  src:
    description:
      - The remote path of the application ear or war to deploy.
      - Required when O(state=present).
      - Ignored when O(state=absent).
    type: path
  deploy_path:
    default: /var/lib/jbossas/standalone/deployments
    description:
      - The location in the filesystem where the deployment scanner listens.
    type: path
  state:
    choices: [present, absent]
    default: "present"
    description:
      - Whether the application should be deployed or undeployed.
    type: str
notes:
  - The JBoss standalone deployment-scanner has to be enabled in C(standalone.xml).
  - The module can wait until O(deployment) file is deployed/undeployed by deployment-scanner. Duration of waiting time depends
    on scan-interval parameter from C(standalone.xml).
  - Ensure no identically named application is deployed through the JBoss CLI.
seealso:
  - name: WildFly reference
    description: Complete reference of the WildFly documentation.
    link: https://docs.wildfly.org
author:
  - Jeroen Hoekx (@jhoekx)
a%  
- name: Deploy a hello world application to the default deploy_path
  community.general.jboss:
    src: /tmp/hello-1.0-SNAPSHOT.war
    deployment: hello.war
    state: present

- name: Update the hello world application to the non-default deploy_path
  community.general.jboss:
    src: /tmp/hello-1.1-SNAPSHOT.war
    deploy_path: /opt/wildfly/deployment
    deployment: hello.war
    state: present

- name: Undeploy the hello world application from the default deploy_path
  community.general.jboss:
    deployment: hello.war
    state: absent
z # N)AnsibleModulez'/var/lib/jbossas/standalone/deploymentsc                     t         j                  j                  t         j                  j                  | d|z              S )N%s.deployedospathexistsjoindeploy_path
deployments     k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/jboss.pyis_deployedr   Z   s)    77>>"'',,{MJ4NOPP    c                     t         j                  j                  t         j                  j                  | d|z              S )Nz%s.undeployedr	   r   s     r   is_undeployedr   ^   s)    77>>"'',,{Oj4PQRRr   c                     t         j                  j                  t         j                  j                  | d|z              S )N	%s.failedr	   r   s     r   	is_failedr   b   s)    77>>"'',,{K*4LMNNr   c                     t        t        t        d      t        dd      t        dt              t        dddgd	      
      dgd      } t        d      }| j                  d   }| j                  d   }| j                  d   }| j                  d   }t        j
                  j                  |      s| j                  d       |dk(  r|r| j                  d       n9|dk(  r4t        j
                  j                  |      s| j                  d|z         t        ||      }| j                  rt|dk(  rQ|sd|d<   nU|rS| j                  |      | j                  t        j
                  j                  ||            k7  rd|d<   n|dk(  r|rd|d<    | j                  di | |dk(  r|st        ||      r6t	        j                  t        j
                  j                  |d|z               | j!                  |t        j
                  j                  ||             |sEt        ||      }t        ||      r| j                  d|z         t#        j$                  d       |sEd|d<   |dk(  r|r| j                  |      | j                  t        j
                  j                  ||            k7  rt	        j                  t        j
                  j                  |d|z               | j!                  |t        j
                  j                  ||             d}|sEt        ||      }t        ||      r| j                  d|z         t#        j$                  d       |sEd|d<   |dk(  r|rt	        j                  t        j
                  j                  |d|z               |rFt'        ||       }t        ||      r| j                  d|z         t#        j$                  d       |rFd|d<    | j                  di | y )Nr   )typestrT)r   required)r   defaultabsentpresent)r   choicesr   )srcr   r   state)r"   r   )r!   )argument_specrequired_ifsupports_check_modeF)changedr!   r   r   r"   zdeploy_path does not exist.)msgz*Parameter src is ignored when state=absentzSource file %s does not exist.r&   r   zDeploying %s failed.   r   zUndeploying %s failed. )r   dictDEFAULT_DEPLOY_PATHparamsr
   r   r   	fail_jsonwarnr   
check_modesha1r   	exit_jsonr   removepreserved_copytimesleepr   )moduleresultr!   r   r   r"   deployeds          r   mainr9   f   sq   &!6&2EFEHi+@)T	
 44 	F % F
--
C|,J--.KMM'"E77>>+&:;S@A	)	BGGNN3$7=CD;
3H I$(y!;;s#v{{277<<Z3X'YY(,F9%h8 $F9"6" 	([*-IIbggll;j0HIJc277<<Z#HI";
;Hj1  %;j%H IJJqM	 
 !y	h;;sv{{277<<Z+PQQIIbggll;
0JKL!!#rww||K'LMH&{J?[*5$$)?*)L$M

1	 
 !%F9X
		"'',,{MJ,FGH(jAAHj1  %=
%J KJJqM	 
 !yFvr   __main__)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNr
   r4   ansible.module_utils.basicr   r+   r   r   r   r9   __name__r)   r   r   <module>rB      sh    A @.`( 
 	  4 @ QSOOd zF r   