%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/beacons/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/beacons/haproxy.pyc

�
���^c@@sldZddlmZmZddlZddlmZeje�Z	dZ
d�Zd�Zd�Z
dS(	u�
Watch current connections of haproxy server backends.
Fire an event when over a specified threshold.

.. versionadded:: 2016.11.0
i(tabsolute_importtunicode_literalsN(tmapuhaproxycC@s%dtkrtStjd�tSdS(u@
    Only load the module if haproxyctl module is installed
    uhaproxy.get_sessionsuNot loading haproxy beaconN(t__salt__t__virtualname__tlogtdebugtFalse(((s8/usr/lib/python2.7/site-packages/salt/beacons/haproxy.pyt__virtual__s
cC@s�t|t�stdfSi}tt|j|��d|krKtdfSt|dt�shtdfSxs|dD]g}tjd|d|�d|d|kr�tdfS|d|d}t|t�sstdfSqsWtd	fS(
u+
    Validate the beacon configuration
    u0Configuration for haproxy beacon must be a list.ubackendsu3Configuration for haproxy beacon requires backends.u1Backends for haproxy beacon must be a dictionary.u
_config %suserversu,Backends for haproxy beacon require servers.u*Servers for haproxy beacon must be a list.uValid beacon configuration(	t
isinstancetlistRRtupdatetdictRRtTrue(tconfigt_configtbackendt_servers((s8/usr/lib/python2.7/site-packages/salt/beacons/haproxy.pytvalidates 



c	C@s�g}i}tt|j|��x�|jdd�D]�}|d|}|d}x�|dD]~}td||�}|r^t|�t|�kr�i|d6|d6|d6}tjd||||�|j|�q�q^q^Wq5W|S(	u�
    Check if current number of sessions of a server for a specific haproxy backend
    is over a defined threshold.

    .. code-block:: yaml

        beacons:
          haproxy:
            - backends:
                www-backend:
                    threshold: 45
                    servers:
                      - web1
                      - web2
            - interval: 120
    ubackendsu	thresholduserversuhaproxy.get_sessionsuserveruscuru!Emit because %s > %s for %s in %s((	R
RRtgetRtintRRtappend(	RtretRRtbackend_configt	thresholdtservertscurt_server((s8/usr/lib/python2.7/site-packages/salt/beacons/haproxy.pytbeacon>s(


	(t__doc__t
__future__RRtloggingtsalt.ext.six.movesRt	getLoggert__name__RRRRR(((s8/usr/lib/python2.7/site-packages/salt/beacons/haproxy.pyt<module>s		 

Zerion Mini Shell 1.0