403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/proxy_example.py
"""
Example beacon to use with salt-proxy

.. code-block:: yaml

    beacons:
      proxy_example:
        endpoint: beacon
"""

import logging

import salt.utils.beacons
import salt.utils.http

# Important: If used with salt-proxy
# this is required for the beacon to load!!!
__proxyenabled__ = ["*"]

__virtualname__ = "proxy_example"

log = logging.getLogger(__name__)


def __virtual__():
    """
    Trivially let the beacon load for the test example.
    For a production beacon we should probably have some expression here.
    """
    return True


def validate(config):
    """
    Validate the beacon configuration
    """
    if not isinstance(config, list):
        return False, "Configuration for proxy_example beacon must be a list."
    return True, "Valid beacon configuration"


def beacon(config):
    """
    Called several times each second
    https://docs.saltproject.io/en/latest/topics/beacons/#the-beacon-function

    .. code-block:: yaml

        beacons:
          proxy_example:
            - endpoint: beacon
    """
    # Important!!!
    # Although this toy example makes an HTTP call
    # to get beacon information
    # please be advised that doing CPU or IO intensive
    # operations in this method will cause the beacon loop
    # to block.
    config = salt.utils.beacons.list_to_dict(config)

    beacon_url = "{}{}".format(__opts__["proxy"]["url"], config["endpoint"])
    ret = salt.utils.http.query(beacon_url, decode_type="json", decode=True)
    return [ret["dict"]]

Youez - 2016 - github.com/yon3zu
LinuXploit