feat(hub): report seats_taken in WebSocket license sync and telemetry
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 22s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 22s
This commit is contained in:
+14
-1
@@ -1682,12 +1682,25 @@ def main():
|
||||
ca_info = enrollment.extract_license_info_from_cert(f.read())
|
||||
|
||||
ws_url = lic_server if ("ws://" in lic_server or "wss://" in lic_server) else f"{lic_server.replace('https://', 'wss://').replace('http://', 'ws://').rstrip('/')}/ws/license"
|
||||
|
||||
active_seats = 0
|
||||
if os.path.exists(config.get("db_path", "server_logs.db")):
|
||||
try:
|
||||
conn_tmp = sqlite3.connect(config.get("db_path", "server_logs.db"))
|
||||
row = conn_tmp.execute("SELECT COUNT(*) FROM clients WHERE status = 'active'").fetchone()
|
||||
if row:
|
||||
active_seats = row[0]
|
||||
conn_tmp.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
success, msg, res = enrollment.enroll_and_sync_license_ws(
|
||||
cert_dir=cert_dir,
|
||||
license_id=ca_info.get("license_id"),
|
||||
license_authority_ws_url=ws_url,
|
||||
server_fingerprint=config.get("server_fingerprint", ""),
|
||||
hostname=config.get("server_name", "")
|
||||
hostname=config.get("server_name", ""),
|
||||
seats_taken=active_seats
|
||||
)
|
||||
|
||||
if not success or not res:
|
||||
|
||||
Reference in New Issue
Block a user