-
Notifications
You must be signed in to change notification settings - Fork 44
/
bz1948052
executable file
·33 lines (30 loc) · 1.08 KB
/
bz1948052
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# long_name: Checks for BZ 1948052
# description: Checks for BZ 1948052 based on kernel version
# bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1948052
# priority: 600
[ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils")
BADKERNEL="4.18.0-193.24.1.el8_2.dt1.x86_64"
error=false
if oc auth can-i get nodes >/dev/null 2>&1; then
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
kernel_version=$(oc get ${node} -o jsonpath={.status.nodeInfo.kernelVersion})
if [[ ${kernel_version} == ${BADKERNEL} ]]; then
msg "${RED}Node ${node} contains ${BADKERNEL} kernel version${NOCOLOR}"
errors=$(("${errors}" + 1))
error=true
fi
done
if [ ! -z "${ERRORFILE}" ]; then
echo $errors >${ERRORFILE}
fi
if [[ $error == true ]]; then
exit ${OCERROR}
else
exit ${OCOK}
fi
else
msg "Couldn't get nodes, check permissions"
exit ${OCSKIP}
fi
exit ${OCUNKNOWN}