2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-01-10 10:02:32 +00:00

WIP toward rescan hitting the renotify on subscripbed switches

This commit is contained in:
Jarrod Johnson
2022-11-03 10:49:58 -04:00
parent f1a0d22fe5
commit 327a45ef33
3 changed files with 16 additions and 2 deletions

View File

@@ -138,6 +138,7 @@ def load_plugins():
plugins.clear()
# restore path to not include the plugindir
sys.path.pop(1)
disco.register_affluent(pluginmap['affluent'])
def _register_resource(plugin):
@@ -1239,7 +1240,7 @@ def handle_path(path, operation, configmanager, inputdata=None, autostrip=True):
operation, pathcomponents, autostrip)
elif pathcomponents[0] == 'discovery':
return disco.handle_api_request(
configmanager, inputdata, operation, pathcomponents, pluginmap['affluent'])
configmanager, inputdata, operation, pathcomponents)
elif pathcomponents[0] == 'networking':
return macmap.handle_api_request(
configmanager, inputdata, operation, pathcomponents)

View File

@@ -186,6 +186,10 @@ pending_nodes = {}
pending_by_uuid = {}
def register_affluent(affluenthdl):
global affluent
affluent = affluenthdl
def enrich_pxe_info(info):
sn = None
mn = None
@@ -438,7 +442,7 @@ def save_subscriptions(subs):
with open('/etc/confluent/discovery_subscriptions.json', 'w') as dso:
dso.write(json.dumps(subs))
def handle_api_request(configmanager, inputdata, operation, pathcomponents, affluent=None):
def handle_api_request(configmanager, inputdata, operation, pathcomponents):
if pathcomponents == ['discovery', 'autosense']:
return handle_autosense_config(operation, inputdata)
if operation == 'retrieve' and pathcomponents[:2] == ['discovery', 'subscriptions']:
@@ -1446,6 +1450,9 @@ def rescan():
return
else:
scanner = eventlet.spawn(blocking_scan)
for remagent in get_subscriptions():
affluent.
def blocking_scan():

View File

@@ -54,6 +54,12 @@ class WebClient(object):
return rsp
def renotify_me(node, configmanager, myname):
creds = configmanager.get_node_attributes(
node, ['secret.hardwaremanagementuser', 'secret.hardwaremanagementpassword'], decrypt=True)
wc = WebClient(node, configmanager, creds)
wc.wc.grab_json_response('/affluent/cert_authorities/{0}'.format(myname), cacert)
def subscribe_discovery(node, configmanager, myname):
creds = configmanager.get_node_attributes(
node, ['secret.hardwaremanagementuser', 'secret.hardwaremanagementpassword'], decrypt=True)