2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-03 16:07:00 +00:00

Keep the SMM web session across settings operations

Every getter and setter logged out on the way out, which nulled the
cached client and made the session cache inert on exactly the paths it
was meant to serve: a single nodeconfig walk of ntp costs two full
logins for the read and one per server for the write, each of them a
fresh TLS handshake plus, on firmware that omits st2, two extra page
fetches to scrape the tokens.

Leave the session in place and let wc() dispose of it once it expires.
This also stops one coroutine's logout from invalidating the session
another coroutine just fetched and is about to post with.
This commit is contained in:
Markus Hilger
2026-07-27 00:28:59 +02:00
parent 474e2bd975
commit 1031bad407
@@ -890,11 +890,9 @@ class SMMClient(object):
rsp, status, _ = await wc.grab_response_with_status('/data', 'set=hostname:' + hostname)
if status != 200:
raise Exception(rsp)
await self.logout()
async def get_hostname(self):
currinfo = await self.get_netinfo()
await self.logout()
for data in currinfo.find('netConfig').findall('hostname'):
return data.text
@@ -913,11 +911,9 @@ class SMMClient(object):
rsp, status, _ = await wc.grab_response_with_status('/data', 'set=dnsDomain:' + domain)
if status != 200:
raise Exception(rsp)
await self.logout()
async def get_domain(self):
currinfo = await self.get_netinfo()
await self.logout()
for data in currinfo.find('netConfig').findall('dnsDomain'):
return data.text
@@ -927,7 +923,6 @@ class SMMClient(object):
if status != 200:
raise Exception(rsp)
info = fromstring(rsp)
await self.logout()
for data in info.findall('ntpOpMode'):
return data.text == '1'
@@ -939,7 +934,6 @@ class SMMClient(object):
raise Exception(result)
if not isinstance(result, str):
result = result.decode('utf8')
await self.logout()
if '<status>ok</status>' not in result:
raise Exception("Unrecognized result: " + result)
@@ -953,7 +947,6 @@ class SMMClient(object):
result = result.decode('utf8')
if '<status>ok</status>' not in result:
raise Exception("Unrecognized result: " + result)
await self.logout()
return True
async def get_ntp_servers(self):
@@ -970,7 +963,6 @@ class SMMClient(object):
srvs.append(data.text)
for data in result.findall('ntpServer3'):
srvs.append(data.text)
await self.logout()
return srvs
async def update_firmware(self, filename, data=None, progress=None, bank=None):