propagation: single registry drives all node references
New bin/netvm-registry.py parses NODES.md (node -> cdp_port); every consumer reads from it instead of hardcoding: - onboard-driver.py: CDP_PORTS dict -> registry lookup (new nodes work) - muse-signin.py: hardcoded 9410 -> --node/--cdp-port args - muse-chat-api.py: hardcoded ACCOUNTS -> registry-built - agent-health.sh: hardcoded muse/pip blocks -> loop over all active nodes (646 and opm now get health coverage too) NODES.md: record opm node (9440).
This commit is contained in:
+29
-5
@@ -16,12 +16,25 @@ The operator then obtains the OTP (via chat with user) and re-runs:
|
||||
This keeps credentials out of the automation — the OTP is provided
|
||||
transiently via the operator, never stored.
|
||||
"""
|
||||
import json, urllib.request, websocket, time, sys, argparse
|
||||
import json, urllib.request, websocket, time, sys, argparse, importlib.util
|
||||
|
||||
CDP_URL = "http://127.0.0.1:9410/json/list"
|
||||
CDP_PORT_DEFAULT = 9410
|
||||
|
||||
def get_page():
|
||||
with urllib.request.urlopen(CDP_URL, timeout=5) as r:
|
||||
|
||||
def _registry_port(node):
|
||||
try:
|
||||
path = "/home/super/Projects/NetVM/bin/netvm-registry.py"
|
||||
spec = importlib.util.spec_from_file_location("netvm_registry", path)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
return mod.port_for(node)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def get_page(port):
|
||||
cdp_url = "http://127.0.0.1:%s/json/list" % port
|
||||
with urllib.request.urlopen(cdp_url, timeout=5) as r:
|
||||
ts = json.load(r)
|
||||
pages = [t for t in ts if t.get('type') == 'page']
|
||||
if not pages:
|
||||
@@ -41,9 +54,20 @@ def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--email', required=True)
|
||||
p.add_argument('--otp', default=None)
|
||||
p.add_argument('--node', default=None,
|
||||
help='node name: CDP port comes from the NODES.md registry')
|
||||
p.add_argument('--cdp-port', default=None,
|
||||
help='explicit CDP port (overrides --node lookup)')
|
||||
args = p.parse_args()
|
||||
|
||||
page = get_page()
|
||||
if args.cdp_port:
|
||||
port = args.cdp_port
|
||||
elif args.node:
|
||||
port = _registry_port(args.node) or CDP_PORT_DEFAULT
|
||||
else:
|
||||
port = CDP_PORT_DEFAULT
|
||||
|
||||
page = get_page(port)
|
||||
ws = websocket.create_connection(page['webSocketDebuggerUrl'], timeout=15)
|
||||
|
||||
# Step 1: Check if already logged in
|
||||
|
||||
Reference in New Issue
Block a user