%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@skdZddlmZmZmZddlZddlZddlZddl	Z
ddddd�ZdS(u
Send events from webhook api
i(tabsolute_importtprint_functiontunicode_literalsNi�c	@stjd�dkr7tjjjttd�j�nd
��fd��dtj	j
f�fd��Y}tj	jd|fg�}d
}t||g�r�i|d6|d	6}ntj
jd
t�}|j�tjj|d|�}|j|d|�|j�d
S(u
    Api to listen for webhooks to send to the reactor.

    Implement the webhook behavior in an engine.
    :py:class:`rest_cherrypy Webhook docs <salt.netapi.rest_cherrypy.app.Webhook>`

    Unlike the rest_cherrypy Webhook, this is only an unauthenticated webhook
    endpoint.  If an authenticated webhook endpoint is needed, use the salt-api
    webhook which runs on the master and authenticates through eauth.

    .. note: This is really meant to be used on the minion, because salt-api
             needs to be run on the master for use with eauth.

    .. warning:: Unauthenticated endpoint

        This engine sends webhook calls to the event stream.  If the engine is
        running on a minion with `file_client: local` the event is sent to the
        minion event stream.  Otherwise it is sent to the master event stream.

    Example Config

    .. code-block:: yaml

        engines:
          - webhook: {}

    .. code-block:: yaml

        engines:
          - webhook:
              port: 8000
              address: 10.128.1.145
              ssl_crt: /etc/pki/tls/certs/localhost.crt
              ssl_key: /etc/pki/tls/certs/localhost.key

    .. note: For making an unsigned key, use the following command
             `salt-call --local tls.create_self_signed_cert`
    u__roleumasterusock_dirc@s+�r�||�ntd||�dS(u'
        How to fire the event
        u
event.sendN(t__salt__(ttagtmsg(tfire_master(s8/usr/lib/python2.7/site-packages/salt/engines/webhook.pytfire<stWebHookc@seZ�fd�ZRS(c@s\|jj}|jj}it|t�r0|n	t|�d6|d6}�d||�dS(Nuheadersubodyusalt/engines/hook/(trequesttbodytheaderst
isinstancetdict(tselfRR
Rtpayload(R(s8/usr/lib/python2.7/site-packages/salt/engines/webhook.pytpostFs"
(t__name__t
__module__R((R(s8/usr/lib/python2.7/site-packages/salt/engines/webhook.pyREsu/(.*)ucertfileukeyfiletmake_currenttssl_optionstaddressN(t__opts__tgettsalttutilsteventtget_master_eventt
fire_eventtNonettornadotwebtRequestHandlertApplicationtalltiolooptIOLooptFalseRt
httpservert
HTTPServertlistentstart(	Rtporttssl_crttssl_keyRtapplicationRtio_loopthttp_server((RRs8/usr/lib/python2.7/site-packages/salt/engines/webhook.pyR)s'"	"

(
t__doc__t
__future__RRRttornado.httpserverRttornado.ioloopttornado.webtsalt.utils.eventRRR)(((s8/usr/lib/python2.7/site-packages/salt/engines/webhook.pyt<module>s

Zerion Mini Shell 1.0