From ffaabd5ae3156fd946077b9dda691488a04f25db Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 18 Oct 2017 09:51:31 -0400 Subject: [PATCH] Do not process incomplete DIMM info A malformed SPD given by BMC is now presented as Unrecognized, rather than trying to format data that does not exist. --- confluent_client/bin/nodeinventory | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_client/bin/nodeinventory b/confluent_client/bin/nodeinventory index be3c03c1..926b8415 100755 --- a/confluent_client/bin/nodeinventory +++ b/confluent_client/bin/nodeinventory @@ -46,14 +46,17 @@ def pretty(text): return text def print_mem_info(node, prefix, meminfo): - capacity = meminfo['capacity_mb'] / 1024 memdescfmt = '{0}GB PC' if meminfo['memory_type'] == 'DDR3 SDRAM': memdescfmt += '3-{1} ' elif meminfo['memory_type'] == 'DDR4 SDRAM': memdescfmt += '4-{1} ' + elif meminfo['memory_type'] == 'Unknown': + print('{0}: Unrecognized Memory'.format(node)) + return if meminfo['ecc']: memdescfmt += 'ECC ' + capacity = meminfo['capacity_mb'] / 1024 memdescfmt += meminfo['module_type'] memdesc = memdescfmt.format(capacity, meminfo['speed']) print('{0}: {1} description: {2}'.format(node, prefix, memdesc))