mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-21 08:33:23 +00:00
Add auto-register on IP assign
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user