From 129f034c0783030512d01bb8aa4eb5bd0c3b9ee2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 12 May 2016 09:19:30 -0400 Subject: [PATCH] Provide some more friendly string values Some keys from the API are a little weird, provide a mapping for them. --- confluent_client/bin/nodeinventory | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/confluent_client/bin/nodeinventory b/confluent_client/bin/nodeinventory index cd8cce71..81501282 100644 --- a/confluent_client/bin/nodeinventory +++ b/confluent_client/bin/nodeinventory @@ -25,6 +25,13 @@ if path.startswith('/opt'): import confluent.client as client +def pretty(text): + if text == 'pcislot': + return 'PCI slot' + if text == 'partnumber': + return 'part number' + return text + def print_mem_info(node, prefix, meminfo): capacity = meminfo['capacity_mb'] / 1024 memdescfmt = '{0}GB PC' @@ -76,7 +83,8 @@ try: for datum in info: if info[datum] is None: continue - print('{0}: {1} {2}: {3}'.format(node, prefix, datum, + print('{0}: {1} {2}: {3}'.format(node, prefix, + pretty(datum), info[datum])) exitcode = 0 sys.exit(