summaryrefslogtreecommitdiff
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2018-09-28 14:10:52 -0400
committerJeff Lane <jeffrey.lane@canonical.com>2018-09-28 14:10:52 -0400
commit4103d53919e67bb58754298400b72d2bb4371ffa (patch)
tree320d7916d628f667f1dd5aaf5a3af3662de86fc0
parente9cd542555b76fbc61f9483fbceb68f0749affa1 (diff)
Fixed issue that breaks ipmi_test on some systems that require a specific channel to be used. LP: #1794926
-rwxr-xr-xbin/ipmi_test19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/ipmi_test b/bin/ipmi_test
index 71e7f36..59d7aac 100755
--- a/bin/ipmi_test
+++ b/bin/ipmi_test
@@ -28,10 +28,27 @@ done
echo
echo "Checking for chassis status"
ipmitool chassis status && echo "Successfully got chassis status" && chassis=0 || chassis=1
+
echo "Checking to see if we can get power status"
ipmitool power status && echo "Successfully got power status" && power=0 || power=1
+
echo "Checking to see if we can get user data"
-ipmitool user list && echo "Successfully got user data" && user=0 || user=1
+# LP:1794926 Find the active channel. blindly calling user list sometimes
+# fails.
+channel=99
+for x in 0 1 2 3 4 5 6 7 8 9 10 11 14 15; do
+ if ipmitool channel getaccess $x 2>1 >/dev/null; then
+ echo "Channel in use appears to be $channel"
+ channel=$x
+ break
+ fi
+done
+if [ $channel -lt 99 ]; then
+ ipmitool user list $channel && echo "Successfully got user data" && user=0 || user=1
+else
+ user=1
+fi
+
echo "Checking to see if we can get info on the BMC"
ipmitool bmc info && echo "Successfully got BMC information" && bmc=0 || bmc=1