File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/tomcat.cpython-310.pyc
o
�N�g�I � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
ZddlZe�
e�ZddiZddgddgd �Zd
d� Zdd
� Zdd� Zdd� Zdd� ZdCdd�ZdDdd�ZdDdd�ZdDdd�ZdDdd�ZdDd d!�ZdDd"d#�ZdDd$d�ZdDd%d&�ZdDd'd(�Z dDd)d*�Z!dDd+d,�Z" - . /dEd0d1�Z#dFd4d5�Z$d6d7� Z%d8d9� Z&dGd:d;�Z'ed<kr�i Z(i Z)d=d>d?�Z*e� Z+d@d=d>d �iZ*e� Z,e+e,kr�e�-dA� dS e�.dB� dS dS )Ha�
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ipv6 interface
"0:0:0:0:0:0:0:1"
- If you are using tomcat.tar.gz it has to be installed or symlinked under
``/opt``, preferably using name tomcat
- "tomcat.signal start/stop" works but it does not use the startup scripts
The following grains/pillar should be set:
.. code-block:: yaml
tomcat-manager:
user: <username>
passwd: <password>
or the old format:
.. code-block:: yaml
tomcat-manager.user: <username>
tomcat-manager.passwd: <password>
Also configure a user in the conf/tomcat-users.xml file:
.. code-block:: xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script"/>
</tomcat-users>
.. note::
- More information about tomcat manager:
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
- if you use only this module for deployments you've might want to strict
access to the manager only from localhost for more info:
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access
- Tested on:
JVM Vendor:
Sun Microsystems Inc.
JVM Version:
1.6.0_43-b01
OS Architecture:
amd64
OS Name:
Linux
OS Version:
2.6.32-358.el6.x86_64
Tomcat Version:
Apache Tomcat/7.0.37
� N�reload_�reload�tomcat-manager.userztomcat-manager:user�tomcat-manager.passwdztomcat-manager:passwd��user�passwdc C s t � std�r dS dS )zO
Only load tomcat if it is installed or if grains/pillar config exists
ZdummyZtomcat)Fz�Tomcat execution module not loaded: neither Tomcat installed locally nor tomcat-manager credentials set in grains/pillar/config.)�__catalina_home�_auth� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/tomcat.py�__virtual__W s r
c C sJ ddg} | D ]}t � |�}|r"|D ]}tj�|d �r!| S qqdS )z4
Tomcat paths differ depending on packaging
z/usr/share/tomcat*z/opt/tomcatz/binF)�glob�os�path�isdir)Z locations�locationZfoldersZ
catalina_homer r r r d s
��r c C sd ddd�} | D ]"}t ttfD ]}t| D ]}tjj�||d�}|r'|| |<