From 46c9c3e6db0642da6d75e5576e7abdbd592b70cc Mon Sep 17 00:00:00 2001 From: Mike Choi Date: Mon, 22 Oct 2018 16:38:47 -0700 Subject: [PATCH] common: Fix FRU display error in log-util (#98) Summary: FRU number always shows one digit even if there are two. Modify the display rule to correct it. Example: Before modify: 1 scm 2018-10-17 02:09:45 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 12, num: 0x17 curr_val: 9024.00 RPM, thresh_val: 8500.00 RPM, snr: PSU2_FAN_SPEED 1 scm 2018-10-17 02:09:47 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 13, num: 0x24 curr_val: 9024.00 RPM, thresh_val: 8500.00 RPM, snr: PSU3_FAN_SPEED 1 scm 2018-10-17 02:09:48 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 14, num: 0x31 curr_val: 8992.00 RPM, thresh_val: 8500.00 RPM, snr: PSU4_FAN_SPEED After modify: 12 psu2 2018-10-17 02:09:45 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 12, num: 0x17 curr_val: 9024.00 RPM, thresh_val: 8500.00 RPM, snr: PSU2_FAN_SPEED 13 psu3 2018-10-17 02:09:47 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 13, num: 0x24 curr_val: 9024.00 RPM, thresh_val: 8500.00 RPM, snr: PSU3_FAN_SPEED 14 psu4 2018-10-17 02:09:48 sensord ASSERT: Upper Non Critical threshold - raised - FRU: 14, num: 0x31 curr_val: 8992.00 RPM, thresh_val: 8500.00 RPM, snr: PSU4_FAN_SPEED Pull Request resolved: https://github.com/facebookexternal/openbmc.accton/pull/98 Test Plan: Test on minipack: pass Reviewed By: amithash fbshipit-source-id: a28726d45 --- common/recipes-core/log-util/files/log-util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/recipes-core/log-util/files/log-util.py b/common/recipes-core/log-util/files/log-util.py index 0499b0947a42..c6f97a974f7a 100644 --- a/common/recipes-core/log-util/files/log-util.py +++ b/common/recipes-core/log-util/files/log-util.py @@ -149,7 +149,7 @@ def log_main(): if re.search(r'FRU: [0-9]{1,2}', log, re.IGNORECASE): fru_num = ''.join(re.findall(r'FRU: [0-9]{1,2}', log, re.IGNORECASE)) # FRU is in format "FRU: X" - fru_num = fru_num[5] + fru_num = fru_num.split(" ")[1] else: fru_num = '0' @@ -199,7 +199,7 @@ def log_main(): if re.search(r'FRU: [0-9]{1,2}', log, re.IGNORECASE): fru_num = ''.join(re.findall(r'FRU: [0-9]{1,2}', log, re.IGNORECASE)) # FRU is in format "FRU: X" - fru_num = fru_num[5] + fru_num = fru_num.split(" ")[1] else: fru_num = '0'