003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/proxy
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
proxy
/
📁
..
📄
__init__.py
(27 B)
📁
__pycache__
📄
arista_pyeapi.py
(4.5 KB)
📄
chronos.py
(1.62 KB)
📄
cimc.py
(9.01 KB)
📄
cisconso.py
(8.72 KB)
📄
deltaproxy.py
(1.61 KB)
📄
docker.py
(1.3 KB)
📄
dummy.py
(6.49 KB)
📄
esxcluster.py
(8.26 KB)
📄
esxdatacenter.py
(8.13 KB)
📄
esxi.py
(18.46 KB)
📄
esxvm.py
(7.66 KB)
📄
fx2.py
(12.02 KB)
📄
junos.py
(7.12 KB)
📄
marathon.py
(1.67 KB)
📄
napalm.py
(12.49 KB)
📄
netmiko_px.py
(12.17 KB)
📄
nxos.py
(15.49 KB)
📄
nxos_api.py
(6.31 KB)
📄
panos.py
(15.15 KB)
📄
philips_hue.py
(13.5 KB)
📄
rest_sample.py
(6.24 KB)
📄
ssh_sample.py
(5.26 KB)
📄
vcenter.py
(9.71 KB)
Editing: marathon.py
""" Marathon ======== Proxy minion for managing a Marathon cluster. Dependencies ------------ - :mod:`marathon execution module (salt.modules.marathon) <salt.modules.marathon>` Pillar ------ The marathon proxy configuration requires a 'base_url' property that points to the marathon endpoint: .. code-block:: yaml proxy: proxytype: marathon base_url: http://my-marathon-master.mydomain.com:8080 .. versionadded:: 2015.8.2 """ import logging import salt.utils.http __proxyenabled__ = ["marathon"] CONFIG = {} CONFIG_BASE_URL = "base_url" log = logging.getLogger(__file__) def __virtual__(): return True def init(opts): """ Perform any needed setup. """ if CONFIG_BASE_URL in opts["proxy"]: CONFIG[CONFIG_BASE_URL] = opts["proxy"][CONFIG_BASE_URL] else: log.error("missing proxy property %s", CONFIG_BASE_URL) log.debug("CONFIG: %s", CONFIG) def ping(): """ Is the marathon api responding? """ try: response = salt.utils.http.query( "{}/ping".format(CONFIG[CONFIG_BASE_URL]), decode_type="plain", decode=True, ) log.debug( "marathon.info returned successfully: %s", response, ) if "text" in response and response["text"].strip() == "pong": return True except Exception as ex: # pylint: disable=broad-except log.error( "error calling marathon.info with base_url %s: %s", CONFIG[CONFIG_BASE_URL], ex, ) return False def shutdown(opts): """ For this proxy shutdown is a no-op """ log.debug("marathon proxy shutdown() called...")
Upload File
Create Folder