From 18c24effc6a77056534cb6569c17b61838542526 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 27 Jul 2026 06:15:08 +0200 Subject: [PATCH] Initialize the scan total in nodediscover register register_endpoint primes current but not total, so a first response without a count field goes straight to UnboundLocalError: local variable 'total' referenced before assignment on the elif. Start at zero, which skips the progress line until the server does report a count. --- confluent_client/bin/nodediscover | 1 + 1 file changed, 1 insertion(+) diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index 6838b911..ea93f298 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -53,6 +53,7 @@ columnmapping = { async def register_endpoint(options, session, addr): neednewline = False current = 0 + total = 0 async for rsp in session.update('/discovery/register', {'addresses': addr}): if 'count' in rsp: total = rsp['count']