From fa2232ccff25b6c278338ddee0b6f6a75c741986 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 18 Sep 2026 16:40:10 -0400 Subject: [PATCH] Add auto-register on IP assign --- confluent_client/bin/nodediscover | 5 ++++- confluent_server/confluent/discovery/handlers/nvos.py | 2 +- confluent_server/confluent/netutil.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index 0d67be06..5284fc35 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -353,7 +353,10 @@ async def assign_discovery(options, session, needid=True): matches = [x async for x in list_matching_ents(options, session, None if needid else options.node, False)] if not matches: # Do a rescan to catch missing requested data - await blocking_scan(session) + if needid and options.mac and '.' in options.mac: + await register_endpoint(options, session, options.mac) + else: + await blocking_scan(session) matches = [x async for x in list_matching_ents(options, session, None if needid else options.node, False)] if not matches: sys.stderr.write("No matching discovery candidates found\n") diff --git a/confluent_server/confluent/discovery/handlers/nvos.py b/confluent_server/confluent/discovery/handlers/nvos.py index 969ed333..8e5eb402 100644 --- a/confluent_server/confluent/discovery/handlers/nvos.py +++ b/confluent_server/confluent/discovery/handlers/nvos.py @@ -47,7 +47,7 @@ class NodeHandler(generic.NodeHandler): async with sshclient.connect(myaddress, username='admin', password='admin', nodename=nodename, configmanager=self.configmanager) as conn: res = await conn.run(f"nv set system aaa user admin password '{adminpass}'") if res.exit_status == 0: - res = await conn.run(f'nv config apply') + res = await conn.run('nv config apply') if res.exit_status != 0: raise RuntimeError("Failed to apply NVOS configuration") \ No newline at end of file diff --git a/confluent_server/confluent/netutil.py b/confluent_server/confluent/netutil.py index d38de21c..b2293799 100644 --- a/confluent_server/confluent/netutil.py +++ b/confluent_server/confluent/netutil.py @@ -859,7 +859,7 @@ async def get_nic_config(configmanager, node, ip=None, mac=None, ifidx=None, cfgdata[srvkey] = socket.inet_ntop(fam, svrip) for candidate in cfgbyname: ipmethod = cfgbyname[candidate].get('ipv{}_method'.format(nver), 'static') - leasetime = cfgbyname[candidate].get('lease_time'.format(nver), None) + leasetime = cfgbyname[candidate].get('lease_time', None) if leasetime: cfgdata['lease_time'] = leasetime if not ipmethod: