File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/jboss7.cpython-310.pyc
o
�N�g�P � @ s d Z ddlZddlZddlm mZ ddlmZ e�e �Z
ddiZd/dd�Zd0dd �Z
d0d
d�Zd0dd�Zd
d� Zdd� Zdd� Zd0dd�Zd0dd�Zd0dd�Zd0dd�Zd0dd�Zd0dd�Zd0dd �Z d0d!d"�Zd0d#d$�Zd%d&� Zd0d'd(�Zd)d*� Zd+d,� Zd-d.� Z dS )1a�
Module for managing JBoss AS 7 through the CLI interface.
.. versionadded:: 2015.5.0
In order to run each function, jboss_config dictionary with the following properties must be passed:
* cli_path: the path to jboss-cli script, for example: '/opt/jboss/jboss-7.0/bin/jboss-cli.sh'
* controller: the IP address and port of controller, for example: 10.11.12.13:9999
* cli_user: username to connect to jboss administration console if necessary
* cli_password: password to connect to jboss administration console if necessary
Example:
.. code-block:: yaml
jboss_config:
cli_path: '/opt/jboss/jboss-7.0/bin/jboss-cli.sh'
controller: 10.11.12.13:9999
cli_user: 'jbossadm'
cli_password: 'jbossadm'
� N)�SaltInvocationError�reload_�reloadc C s\ t �d� |du r|du rd}n|dur |dur dj||d�}ntd��td | |dd d
�S )a�
Get status of running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the "host" element in host.xml
server_config
The name of the Server Configuration. JBoss Domain mode only - and required
if running in domain mode.
CLI Example:
.. code-block:: bash
salt '*' jboss7.status '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
z7======================== MODULE FUNCTION: jboss7.statusNz":read-attribute(name=server-state)zK/host="{host}"/server-config="{server_config}"/:read-attribute(name=status))�host�
server_configzKInvalid parameters. Must either pass both host and server_config or neither�jboss7_cli.run_operationFr )�
fail_on_errorZretries)�log�debug�formatr �__salt__)�jboss_configr r � operation� r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/jboss7.py�status# s
���r c C sj t �d� |du rd}nd|� d�}td | |dd�}|d s)|d s+d
|d v r+|S tdjd
i |����)a$
Stop running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the "host" element in host.xml
CLI Example:
.. code-block:: bash
salt '*' jboss7.stop_server '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
z<======================== MODULE FUNCTION: jboss7.stop_serverNz :shutdown�/host="z"/:shutdownr F�r �success� Operation failed: Channel closed�stdout�QCannot handle error, return code={retcode}, stdout='{stdout}', stderr='{stderr}' r �r r
r � Exceptionr )r
r r Zshutdown_resultr r r �stop_serverH s"