2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

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.
This commit is contained in:
Jarrod Johnson 2018-09-07 11:49:13 -04:00
parent e7be24d478
commit 07532e2a3f

View File

@ -87,6 +87,7 @@ def printerror(res, node=None):
url = '/noderange/{0}/inventory/hardware/all/all'
usedprefixes = set([])
argparser = optparse.OptionParser(
usage="Usage: %prog <noderange> [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: