%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/tomcat.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l m Z d � Z e d d d e d � Z d d d � Z d d d � Z d d d � Z d S( u� Manage Apache Tomcat web applications ===================================== .. note:: This state requires the Tomcat Manager webapp to be installed and running. The following grains/pillars must be set for communication with Tomcat Manager to work: .. code-block:: yaml tomcat-manager: user: 'tomcat-manager' passwd: 'Passw0rd' Configuring Tomcat Manager -------------------------- To manage webapps via the Tomcat Manager, you'll need to configure a valid user in the file ``conf/tomcat-users.xml``. .. code-block:: xml :caption: conf/tomcat-users.xml <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager-script"/> <user username="tomcat-manager" password="Passw0rd" roles="manager-script"/> </tomcat-users> Notes ----- - Using multiple versions (aka. parallel deployments) on the same context path is not supported. - More information about the Tomcat Manager: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html - If you use only this module for deployments you might want to restrict access to the manager so it's only accessible via localhost. For more info: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access - Last tested on: Tomcat Version: Apache Tomcat/7.0.54 JVM Vendor: Oracle Corporation JVM Version: 1.8.0_101-b13 OS Architecture: amd64 OS Name: Linux OS Version: 3.10.0-327.22.2.el7.x86_64 i ( t absolute_importt unicode_literalst print_function( t sixc C@ s d t k r d St S( u* Load if the module tomcat exists u tomcat.statusu tomcat( t __salt__t False( ( ( s6 /usr/lib/python2.7/site-packages/salt/states/tomcat.pyt __virtual__@ s u http://localhost:8080/manageri� c C@ s+ i | d 6t d 6i d 6d d 6} | t k rG t d | � pA d } n | sV d } n t d | | � } t } t } t } | r� d j | � n d } y� | | d r� d | | d n d } | | d j | � s� | d k r� | | d | k s� | r@t } t } d j | | � | d d <d j | | � | d d <nT t } d j | | � | d <| | d d k r�d j | � | d d <t } n | SWn1 t k r�t } d j | | � | d d <n Xt d r�d | d <| S| t k r4| t k r0t d | | d | �| d <| d j d � | d <n | S| r}t d | | d | �} | j d � r}t | d <| | d <| Sn t d | | d | t | d | d | �} | j d � rt | d <t j t d | | � | � | d <d j | | � | d d <n% t | d <| | d <| d j d � | S(! u Enforce that the WAR will be deployed and started in the context path, while making use of WAR versions in the filename. .. note:: For more info about Tomcats file paths and context naming, please see http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming name The context path to deploy (incl. forward slash) the WAR to. war Absolute path to WAR file (should be accessible by the user running Tomcat) or a path supported by the ``salt.modules.cp.get_url`` function. force : False Force deployment even if the version strings are the same. Disabled by default. url : http://localhost:8080/manager The URL of the Tomcat Web Application Manager. timeout : 180 Timeout for HTTP requests to the Tomcat Manager. temp_war_location : None Use another location to temporarily copy the WAR file to. By default the system's temp directory is used. version : '' Specify the WAR version. If this argument is provided, it overrides the version encoded in the WAR file name, if one is present. .. versionadded:: 2015.8.6 Use ``False`` or blank value to prevent guessing the version and keeping it blank. .. versionadded:: 2016.11.0 Example: .. code-block:: yaml jenkins: tomcat.war_deployed: - name: /salt-powered-jenkins - war: salt://jenkins-1.2.4.war - require: - service: application-service .. note:: Be aware that in the above example the WAR ``jenkins-1.2.4.war`` will be deployed to the context path ``salt-powered-jenkins##1.2.4``. To avoid this either specify a version yourself, or set version to ``False``. u nameu resultu changesu u commentu tomcat.extract_war_versionu tomcat.lsu version {0}u no versionu versionu version u undeployed {0} with {1}u undeployu will deploy {0} with {1}u deployu {0} with {1} is already deployedu modeu runningu starting {0}u startu deployed {0} with {1}u testu tomcat.startt timeoutu OKu tomcat.undeployu FAILu tomcat.deploy_waru yest temp_war_locationt versionN( t TrueR R t formatt endswitht Exceptiont __opts__t Nonet startswitht __env__R t text_typet pop( t namet wart forcet urlR R R t rett webappst deployt undeployt statust specified_vert current_vert unt deploy_res( ( s6 /usr/lib/python2.7/site-packages/salt/states/tomcat.pyt war_deployedI s� < & $ c C@ sE t d | | � } i | d 6| d 6i d 6| r7 d n d d 6} | S( u� Wait for the Tomcat Manager to load. Notice that if tomcat is not running we won't wait for it start and the state will fail. This state can be required in the tomcat.war_deployed state to make sure tomcat is running and that the manager is running as well and ready for deployment. url : http://localhost:8080/manager The URL of the server with the Tomcat Manager webapp. timeout : 180 Timeout for HTTP request to the Tomcat Manager. Example: .. code-block:: yaml tomcat-service: service.running: - name: tomcat - enable: True wait-for-tomcatmanager: tomcat.wait: - timeout: 300 - require: - service: tomcat-service jenkins: tomcat.war_deployed: - name: /ran - war: salt://jenkins-1.2.4.war - require: - tomcat: wait-for-tomcatmanager u tomcat.statusu nameu resultu changesu tomcat manager is readyu tomcat manager is not readyu comment( R ( R R R t resultR ( ( s6 /usr/lib/python2.7/site-packages/salt/states/tomcat.pyt wait� s % c C@ sR t d | | | � } | j d � } i | d 6| d 6i | | 6d 6| d 6} | S( ui The tomcat watcher, called to invoke the watch command. When called, it will reload the webapp in question .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being triggered. u tomcat.reloadu OKu nameu resultu changesu comment( R R ( R R R t msgR"