Improved error output of obmc_ser_num.
Change-Id: Ic456688f74184a6af92af073f08cbb9b7eea4672
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/obmc_ser_num b/bin/obmc_ser_num
index f9aa2e2..4f7958b 100644
--- a/bin/obmc_ser_num
+++ b/bin/obmc_ser_num
@@ -137,7 +137,12 @@
print_error_report("http request failed:\n" + sprint_var(command, 1))
raise Exception("http request failed.\n")
- mch_ser_num = json['data']['SerialNumber']
+ try:
+ mch_ser_num = json['data']['SerialNumber']
+ except KeyError:
+ print_error_report("Failed to find 'SerialNumber' key in the" +
+ " following data:\n" + sprint_var(json))
+ return False
pvar(mch_ser_num, 0, 0, 0)
return True