From 07532e2a3f0cad84a2e1807d8d50220e5d8fc1ca Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 7 Sep 2018 11:49:13 -0400 Subject: [PATCH] Have nodeinventory disambiguate duplicate labels. The data is still there for putting identical cards together, but the prefix is unique, particularly important for json mode. --- confluent_client/bin/nodeinventory | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/confluent_client/bin/nodeinventory b/confluent_client/bin/nodeinventory index 9c8a6f2b..a2d23bb0 100755 --- a/confluent_client/bin/nodeinventory +++ b/confluent_client/bin/nodeinventory @@ -87,6 +87,7 @@ def printerror(res, node=None): url = '/noderange/{0}/inventory/hardware/all/all' +usedprefixes = set([]) argparser = optparse.OptionParser( usage="Usage: %prog [serial|model|uuid|mac]") @@ -129,6 +130,11 @@ try: continue for inv in res['databynode'][node]['inventory']: prefix = inv['name'] + idx = 2 + while prefix in usedprefixes: + prefix = '{0} {1}'.format(inv['name'], idx) + idx += 1 + usedprefixes.add(prefix) if not inv['present']: if not filters: if options.json: