%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/glassfish.pyo

�
���^c@@srdZddlmZmZmZyBddlZddlmZddl	m
Z
ddlZeZ
Wnek
r}eZ
nXd�Zd�Zd�Zdd	�Zdd
�Zdded
ddddededd�Zedd�Zddedd�Zdd�Zdeddddddddddededd�Zedd�Zdd�Zdd�ZdS(u&
Manage Glassfish/Payara server
.. versionadded:: Carbon

Management of glassfish using it's RESTful API
You can setup connection parameters like this

.. code-block:: yaml
    - server:
      - ssl: true
      - url: localhost
      - port: 4848
      - user: admin
      - password: changeit
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tCommandExecutionErrorcC@sdtkotS(u4
    Only load if glassfish module is available
    uglassfish.enum_connector_c_pool(t__salt__tHAS_LIBS(((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyt__virtual__scC@s�i}xt|j�D]f\}}t|tj�sot|t�rSt|�||<qytj|�j�||<q|||<qW|S(u@
    Encode json values in unicode to match that of the API
    (titemst
isinstanceRt	text_typetdictt_json_to_unicodetlower(tdatatrettkeytvalue((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyR$scC@si}ttjjjtjjj|dt���}tjjjtjjj|dt��}x�|j�D]�\}}tj	|�j
�}||kr�tj	||�j
�}n|dks�|dkr�d}n||krm||krmi|d6|d6||<qmqmW|S(u?
    Compare the API results to the current statefile data
    tensure_asciiunullunoneuuoldunew(RtsalttutilstjsontloadstdumpstFalseRRR
R
(told_conftnew_conftchangedRRtoldvaltnewval((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyt_is_updated4s!*	c	C@s�iid6td6td6dd6}ytdj|��}WnTtjk
r�}tdr�i|d6|d6|d<t|d<|Sd	|d<|SnX|s�||kri|d6|d6|d<t|d<tds�y$td
j|�|d||�Wqtk
r}||d<|SXq�n�|r�t	|�r�tdj|�|d|�}t
||�}|r�t|d<||d<tds�y$td
j|�|d||�Wq�tk
r�}||d<q�Xq�q�n|S(u9
    Generic function to create or update an element
    uchangesuupdateucreateuerroruglassfish.enum_{0}utestuNameuParamsuCan't connect to the serveruglassfish.create_{0}tserveruglassfish.get_{0}uglassfish.update_{0}N(RtNoneRtformattrequeststConnectionErrort__opts__tTrueRtanyR(	tnamet	elem_typeRRRtelementsterrortcurrent_datat	data_diff((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyt_do_element_presentJs>"




$



$cC@s�itd6d	d6}ytdj|��}Wn<tjk
rl}tdr[t|d<|Sd|d<|SnX|r�||kr�t|d<tds�y$tdj|�|d||�Wq�tk
r�}||d<q�Xq�n|S(
u/
    Generic function to delete an element
    udeleteuerroruglassfish.enum_{0}utestucreateuCan't connect to the serveruglassfish.delete_{0}RN(	RR RR!R"R#R$R%R(R'R(RRRR)R*((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyt_do_element_absentqs"




$uconnection_factoryuii�ii,i<c
C@s�i|d6d/d6d/d6id6}
i}i}dj|�}|dkrVd|d<nJ|d	krod
|d<n1|dkr�d|d<nt|
d<d
|
d<|
S||d<||d<||d<||d<||d<||d<||d<||d<|d|d<|	|d<|
rt|
dkr'd|d<qt|
dkr@d|d<qt|
dkrYd|d<qtt|
d<d|
d<|
Sn||d <t|d!||�}t|d"||�}|d#r�|d#r�td$s�t|
d<n|d%s�|d%r1|d|
dd&<|d|
dd'<td$r$d(|
d<q�d)|
d<q�|d*sE|d*r�|d|
dd&<|d|
dd'<td$r�d+|
d<q�d,|
d<q�t|
d<i|
d<d-|
d<n(t|
d<d.j|d#|d#�|
d<|
S(0u:
    Ensures that the Connection Factory is present

    name
        Name of the connection factory

    restype
        Type of the connection factory, can be either ``connection_factory``,
        ``queue_connection_factory` or ``topic_connection_factory``,
        defaults to ``connection_factory``

    description
        Description of the connection factory

    enabled
        Is the connection factory enabled? defaults to ``true``

    min_size
        Minimum and initial number of connections in the pool, defaults to ``1``

    max_size
        Maximum number of connections that can be created in the pool, defaults to ``250``

    resize_quantity
        Number of connections to be removed when idle_timeout expires, defaults to ``2``

    idle_timeout
        Maximum time a connection can remain idle in the pool, in seconds, defaults to ``300``

    wait_timeout
        Maximum time a caller can wait before timeout, in seconds, defaults to ``60``

    reconnect_on_failure
        Close all connections and reconnect on failure (or reconnect only when used), defaults to ``false``
    transaction_support
        Level of transaction support, can be either ``XATransaction``, ``LocalTransaction`` or ``NoTransaction``

    connection_validation
        Connection validation is required, defaults to ``false``
    unameuresultucommentuchangesu{0}-Connection-Poolutopic_connection_factoryu javax.jms.TopicConnectionFactoryuconnectionDefinitionNameuqueue_connection_factoryu javax.jms.QueueConnectionFactoryuconnection_factoryujavax.jms.ConnectionFactoryuInvalid restypeudescriptionuenabledupoolNameusteadyPoolSizeumaxPoolSizeupoolResizeQuantityuidleTimeoutInSecondsi�umaxWaitTimeInMillisufailAllConnectionsuxa_transactionu
XATransactionutransactionSupportulocal_transactionuLocalTransactionuno_transactionu
NoTransactionuInvalid transaction_supportuisConnectionValidationRequireduconnector_c_pooluconnector_resourceuerrorutestucreateupooluresourceu$Connection factory set to be createduConnection factory createduupdateu$Connection factory set to be updateduConnection factory updatedu(Connection factory is already up-to-dateuERROR: {0} // {1}N(R R!RR-R$R%(R'trestypetdescriptiontenabledtmin_sizetmax_sizetresize_quantitytidle_timeouttwait_timeouttreconnect_on_failurettransaction_supporttconnection_validationRRt	pool_datatres_datat	pool_nametpool_rettres_ret((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytconnection_factory_present�sr5"































cC@s�i|d6dd6dd6id6}dj|�}t|di|d6|�}|ds�td	rx|d
rxd|d<q�|d
r�t|d<d|d<q�t|d<d
|d<n!t|d<dj|d�|d<|S(u�
    Ensures the transaction factory is absent.

    name
        Name of the connection factory

    both
        Delete both the pool and the resource, defaults to ``true``
    unameuresultucommentuchangesu{0}-Connection-Pooluconnector_c_poolucascadeuerrorutestudeleteu$Connection Factory set to be deleteduConnection Factory deletedu Connection Factory doesn't existu
Error: {0}N(R R!R.R$R%R(R'tbothRRR<R=((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytconnection_factory_absents
"







uqueuec	C@s�i|d6dd6dd6id6}i}|dkrKd|d<d|d	<n;|d
krnd|d<d|d	<nt|d<d
|d<|Si|d6|d<||d<||d<t|d||�}|ds�tds�t|d<n|drtdrd|d<q�|dr'|d|d<d|d<q�|drHtdrHd|d<q�|drm|d|d<d|d<q�t|d<d|d<n!t|d<dj|d�|d<|S(u|
    Ensures that the JMS Destination Resource (queue or topic) is present

    name
        The JMS Queue/Topic name

    physical
        The Physical destination name

    restype
        The JMS Destination resource type, either ``queue`` or ``topic``, defaults is ``queue``

    description
        A description of the resource

    enabled
        Defaults to ``True``
    unameuresultucommentuchangesuqueueujavax.jms.QueueuresTypeucom.sun.messaging.Queueu	classNameutopicujavax.jms.Topicucom.sun.messaging.TopicuInvalid restypeuNameu
propertiesudescriptionuenableduadmin_object_resourceuerrorutestucreateuJMS Queue set to be createduJMS queue createduupdateuJMS Queue set to be updateduJMS Queue updateduJMS Queue already up-to-dateuError from API: {0}N(R RR-R$R%R!(	R'tphysicalR/R0R1RRtparamstjms_ret((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytdestination_present#sB"



















cC@s�i|d6d
d6d
d6id6}t|di|�}|ds�tdrb|drbd	|d<q�|dr�t|d<d
|d<q�t|d<d|d<n!t|d<dj|d�|d<|S(ug
    Ensures that the JMS Destination doesn't exists

    name
        Name of the JMS Destination
    unameuresultucommentuchangesuadmin_object_resourceuerrorutestudeleteuJMS Queue set to be deleteduJMS Queue deleteduJMS Queue doesn't existu
Error: {0}N(R R.R$R%RR!(R'RRRD((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytdestination_absentds"







u
datasourceumysqlii cC@sRi|d6d>d6d>d6id6}dj|�}i}i}i}|dkr\d|d<nK|d	krud
|d<n2|dkr�d|d<n|d
kr�d|d<ni}idd
6dd6dd	6dd6|d<idd
6dd6dd	6dd6|d<idd
6dd6dd	6dd6|d<|d
kr@||d
|d<n||||d<||d <||d!<||d"<||d#<||d$<||d$<||d%<||d&<||d'<|	|d(<|
|d)<||d*<|d+|d,<|
|d-<||d.<||d/<t|d0||�}t|d1||�}|d2r&|d2r&td3sMt|d<n|d4sa|d4r�|d|dd5<|d|dd6<td3r�d7|d<q#d8|d<qN|d9s�|d9r|d|dd5<|d|dd6<td3r�d:|d<q#d;|d<qNt|d<i|d<d<|d<n(t|d<d=j|d2|d2�|d<|S(?us
    Ensures that the JDBC Datasource exists

    name
        Name of the datasource

    description
        Description of the datasource

    enabled
        Is the datasource enabled? defaults to ``true``

    restype
        Resource type, can be ``datasource``, ``xa_datasource``,
        ``connection_pool_datasource`` or ``driver``, defaults to ``datasource``

    vendor
        SQL Server type, currently supports ``mysql``,
        ``postgresql`` and ``mssql``, defaults to ``mysql``

    sql_url
        URL of the server in jdbc form

    sql_user
        Username for the server

    sql_password
        Password for that username

    min_size
        Minimum and initial number of connections in the pool, defaults to ``8``

    max_size
        Maximum number of connections that can be created in the pool, defaults to ``32``

    resize_quantity
        Number of connections to be removed when idle_timeout expires, defaults to ``2``

    idle_timeout
        Maximum time a connection can remain idle in the pool, in seconds, defaults to ``300``

    wait_timeout
        Maximum time a caller can wait before timeout, in seconds, defaults to ``60``

    non_transactional
        Return non-transactional connections

    transaction_isolation
        Defaults to the JDBC driver default

    isolation_guaranteed
        All connections use the same isolation level
    unameuresultucommentuchangesujdbc/{0}u
datasourceujavax.sql.DataSourceuresTypeu
xa_datasourceujavax.sql.XADataSourceuconnection_pool_datasourceu"javax.sql.ConnectionPoolDataSourceudriverujavax.sql.Driverucom.mysql.jdbc.Driveru-com.mysql.jdbc.jdbc2.optional.MysqlDataSourceu/com.mysql.jdbc.jdbc2.optional.MysqlXADataSourceu;com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSourceumysqluorg.postgresql.Driveru$org.postgresql.ds.PGSimpleDataSourceu org.postgresql.xa.PGXADataSourceu,org.postgresql.ds.PGConnectionPoolDataSourceu
postgresqlu,com.microsoft.sqlserver.jdbc.SQLServerDriveru0com.microsoft.sqlserver.jdbc.SQLServerDataSourceu2com.microsoft.sqlserver.jdbc.SQLServerXADataSourceu>com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSourceumssqludriverClassnameudatasourceClassnameuurluuserupasswordu
propertiesudescriptionupoolNameuenabledusteadyPoolSizeumaxPoolSizeupoolResizeQuantityuidleTimeoutInSecondsi�umaxWaitTimeInMillisunonTransactionalConnectionsutransactionIsolationLeveluisIsolationLevelGuaranteedujdbc_connection_poolu
jdbc_resourceuerrorutestucreateupooluresourceu!JDBC Datasource set to be createduJDBC Datasource createduupdateu!JDBC Datasource set to be updateduJDBC Datasource updatedu%JDBC Datasource is already up-to-dateuERROR: {0} // {1}N(R R!R-R$R%R(R'R0R1R/tvendortsql_urltsql_usertsql_passwordR2R3R4R5R6tnon_transactionalttransaction_isolationtisolation_guaranteedRRtres_nameR:tpool_data_propertiesR;tdatasourcesR=R>((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytjdbc_datasource_present|s�F"






























cC@s�i|d6dd6dd6id6}t|di|d6|�}|ds�tdri|d	rid
|d<q�|d	r�t|d<d|d<q�t|d<d|d<n!t|d<d
j|d�|d<|S(u�
    Ensures the JDBC Datasource doesn't exists

    name
        Name of the datasource
    both
        Delete both the pool and the resource, defaults to ``true``
    unameuresultucommentuchangesujdbc_connection_poolucascadeuerrorutestudeleteu!JDBC Datasource set to be deleteduJDBC Datasource deleteduJDBC Datasource doesn't existu
Error: {0}N(R R.R$R%RR!(R'R@RRR=((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytjdbc_datasource_absents	"







cK@sjidd6dd6dd6id6}|d=ytdd|�}WnFtjk
r�}tdrw||d<d|d<|Sd	|d
<|SnXi|d6|d6|d<||ksH|j|�tds'y6td
|d|�||d<t|d<d|d<WqEtk
r#}||d<t|d<qEXqfd|d<||d<d|d<ni|d<t|d<d|d<|S(uf
    Ensures that the system properties are present

    properties
        The system properties
    uunameuresultucommentuchangesuglassfish.get_system_propertiesRutestuCan't connect to the serveruerrorudataukwargsu"glassfish.update_system_propertiesuSystem properties updatedu)System properties would have been updateducomentu(System properties are already up-to-dateN(	R RR"R#R$tupdateR%RR(RtkwargsRRR*((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytsystem_properties_present7s<"














cC@s8idd6dd6dd6id6}ytdd|�}WnMtjk
r�}tdrwi|d	6|d<d|d<|Sd
|d<|SnX||kr tds�y,td|d|�t|d<d
|d<Wqtk
r�}||d<t|d<qXnd|d<d|d<i|d	6|d<nt|d<d|d<|S(ug
    Ensures that the system property doesn't exists

    name
        Name of the system property
    uunameuresultucommentuchangesuglassfish.get_system_propertiesRutestuNameuCan't connect to the serveruerroru"glassfish.delete_system_propertiesuSystem properties deletedu)System properties would have been deletedu$System properties are already absentN(R RR"R#R$R%RR(R'RRRR*((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pytsystem_properties_absentcs2"









(t__doc__t
__future__RRRtsalt.utils.jsonRtsalt.extRtsalt.exceptionsRR"R%RtImportErrorRRRRR R-R.R?RARERFRQRRRURV(((s9/usr/lib/python2.7/site-packages/salt/states/glassfish.pyt<module>sf


			'p<�,

Zerion Mini Shell 1.0