File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/__pycache__/webhook.cpython-310.pyc
o
�N�g � @ s2 d Z ddlZddlZddlZddlZddd�ZdS )z
Send events from webhook api
� N� c s� t �d�dkrtjj�t t d �j�nd��fdd�� G � fdd�dtjjj j
�}tjjj �d |fg�}d}t||g�rA||d
�}tjjj
jdd�}|�� tjjjj||d
�}|j|| d� |�� dS )a
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`
Z__roleZmasterZsock_dirNc s$ � r � || � dS t d | |� dS )z'
How to fire the event
z
event.sendN)Z__salt__)�tag�msg)�fire_master� �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/webhook.py�fire9 s zstart.<locals>.firec s e Zd Z� fdd�ZdS )zstart.<locals>.WebHookc s>