From f8ea1adec7ad4c4d7b5acf9e9d728ba1dca44c3a Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 27 Jul 2026 06:15:45 +0200 Subject: [PATCH] Keep the nodediscover CSV import going past a failed assignment gather propagates the first exception and leaves its siblings running, so a transport level failure against one node ends the import with a traceback while the rest of the batch is cancelled at loop shutdown. The forked children used to contain such a failure to their own node. assign_macs already reports an error response itself, so this is the connection dropping rather than the server refusing the assignment. Collect the exceptions instead, report each one and count it towards the exit code. Schedule the assignments as tasks while doing so, since the plain coroutines are left unawaited if defining a later node raises before the gather is reached. --- confluent_client/bin/nodediscover | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index 533a983e..4c45a933 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -242,8 +242,12 @@ async def import_csv(options, session): print('Defined ' + res['created']) else: print(repr(res)) - assignments.append(assign_macs(maclist, nodename, assignlimit)) - for rcode in await asyncio.gather(*assignments): + assignments.append( + asyncio.create_task(assign_macs(maclist, nodename, assignlimit))) + for rcode in await asyncio.gather(*assignments, return_exceptions=True): + if isinstance(rcode, BaseException): + sys.stderr.write('Error assigning discovery data: {0}\n'.format(rcode)) + rcode = 1 exitcode |= rcode if exitcode: sys.exit(exitcode)