Moving deltaproxy to open

This commit is contained in:
Gareth J. Greenaway 2021-04-27 12:41:12 -07:00 committed by Megan Wilhite
parent 1f36096219
commit 196ee12110
4 changed files with 1182 additions and 0 deletions

View file

@ -14,6 +14,7 @@ proxy modules
chronos
cimc
cisconso
deltaproxy
docker
dummy
esxcluster

View file

@ -0,0 +1,5 @@
salt.proxy.deltaproxy
=====================
.. automodule:: salt.proxy.deltaproxy
:members:

1094
salt/metaproxy/deltaproxy.py Normal file

File diff suppressed because it is too large Load diff

82
salt/proxy/deltaproxy.py Normal file
View file

@ -0,0 +1,82 @@
"""
This is the "master" deltaproxy minion, known better as the `control proxy` because
it controls all the deltaproxies underneath it.
"""
import logging
# This must be present or the Salt loader won"t load this module
__proxyenabled__ = ["deltaproxy"]
# Variables are scoped to this module so we can have persistent data
# across calls to fns in here.
DETAILS = {}
# Want logging!
log = logging.getLogger(__file__)
# This does nothing, it"s here just as an example and to provide a log
# entry when the module is loaded.
def __virtual__():
"""
Only return if all the modules are available
"""
log.debug("Deltaproxy master proxy __virtual__() called...")
return True
def init(opts):
"""
init
"""
log.debug("deltaproxy proxy init() called...")
DETAILS["initialized"] = True
def initialized():
"""
Since grains are loaded in many different places and some of those ws
places occur before the proxy can be initialized, return whether
our init() function has been called
"""
return DETAILS.get("initialized", False)
def grains():
"""
Make up some grains
"""
if "grains_cache" not in DETAILS:
DETAILS["grains_cache"] = {
"dummy_grain_1": "one",
"dummy_grain_2": "two",
"dummy_grain_3": "three",
}
return DETAILS["grains_cache"]
def grains_refresh():
"""
Refresh the grains
"""
DETAILS["grains_cache"] = None
return grains()
def ping():
"""
Degenerate ping
"""
log.debug("deltaproxy returning ping")
return True
def shutdown(opts):
"""
For this proxy shutdown is a no-op
"""
# TODO call shutdown on all the sub-proxies?
log.debug("deltaproxy shutdown() called...")