forked from RHsyseng/openshift-checks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbiosversion
20 lines (19 loc) · 893 Bytes
/
biosversion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# Check BIOS version to begin with
if oc auth can-i debug node > /dev/null 2>&1; then
msg "Checking bios versions (${BLUE}using oc debug, it can take a while${NOCOLOR})"
# shellcheck disable=SC2016
for node in $(oc get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if eq .type "Ready"}}{{if eq .status "True"}}node/{{$node.metadata.name}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'); do
if ! BIOSVER=$(oc debug --image="${OCDEBUGIMAGE}" "${node}" -- chroot /host sh -c "cat /sys/class/dmi/id/bios_version" 2> /dev/null); then
msg "${ORANGE}Error running oc debug in ${node}${NOCOLOR}"
else
if [ -n "${BIOSVER}" ]; then
msg "${node}: ${BIOSVER}"
else
msg "Couldn't found /sys/class/dmi/id/bios_version in ${node}"
fi
fi
done
else
msg "Couldn't debug nodes, check permissions"
fi