-
Notifications
You must be signed in to change notification settings - Fork 44
/
csr
executable file
·28 lines (25 loc) · 714 Bytes
/
csr
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
#!/usr/bin/env bash
# description: Checks if there are pending csr
[ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils")
error=false
if oc auth can-i get csr >/dev/null 2>&1; then
pending_csr=$(oc get csr --no-headers --ignore-not-found=true | grep -ci 'pending')
if [[ ${pending_csr} -ge 1 ]]; then
PCSR=$(oc get csr --no-headers | grep -i 'pending')
msg "Pending CSRs (${pending_csr}): ${PCSR}"
errors=$(("${errors}" + 1))
error=true
fi
if [ ! -z "${ERRORFILE}" ]; then
echo $errors >${ERRORFILE}
fi
if [[ $error == true ]]; then
exit ${OCERROR}
else
exit ${OCOK}
fi
else
msg "Couldn't get csr, check permissions"
exit ${OCSKIP}
fi
exit ${OCUNKNOWN}