Made environment_check.sh POSIX compliant (#5310)
Made environment_check.sh POSIX compliant Signed-off-by: Harold Holsappel <h.holsappel@iwink.nl> Co-authored-by: Harold Holsappel <h.holsappel@iwink.nl>
This commit is contained in:
parent
4fa27a3ca9
commit
5a071e502c
@ -109,9 +109,9 @@ detect_node_os()
|
|||||||
{
|
{
|
||||||
local pod="$1"
|
local pod="$1"
|
||||||
|
|
||||||
OS=`kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'grep -E "^ID_LIKE=" /etc/os-release | cut -d= -f2'`
|
OS=$(kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'grep -E "^ID_LIKE=" /etc/os-release | cut -d= -f2')
|
||||||
if [[ -z "${OS}" ]]; then
|
if [[ -z "${OS}" ]]; then
|
||||||
OS=`kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'grep -E "^ID=" /etc/os-release | cut -d= -f2'`
|
OS=$(kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'grep -E "^ID=" /etc/os-release | cut -d= -f2')
|
||||||
fi
|
fi
|
||||||
echo "$OS"
|
echo "$OS"
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ check_package_installed() {
|
|||||||
local all_found=true
|
local all_found=true
|
||||||
|
|
||||||
for pod in ${pods}; do
|
for pod in ${pods}; do
|
||||||
OS=`detect_node_os $pod`
|
OS=$(detect_node_os $pod)
|
||||||
if [ x"$OS" == x"" ]; then
|
if [ x"$OS" == x"" ]; then
|
||||||
error "Unable to detect OS on node $node."
|
error "Unable to detect OS on node $node."
|
||||||
exit 2
|
exit 2
|
||||||
@ -243,7 +243,7 @@ check_package_installed() {
|
|||||||
kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- timeout 30 bash -c "$CHECK_CMD $package" > /dev/null 2>&1
|
kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- timeout 30 bash -c "$CHECK_CMD $package" > /dev/null 2>&1
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
all_found=false
|
all_found=false
|
||||||
node=`kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName`
|
node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName)
|
||||||
error "$package is not found in $node."
|
error "$package is not found in $node."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -283,7 +283,7 @@ check_multipathd() {
|
|||||||
kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "systemctl status --no-pager multipathd.service" > /dev/null 2>&1
|
kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "systemctl status --no-pager multipathd.service" > /dev/null 2>&1
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
all_not_found=false
|
all_not_found=false
|
||||||
node=`kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName`
|
node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName)
|
||||||
warn "multipathd is running on $node."
|
warn "multipathd is running on $node."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -302,7 +302,7 @@ check_iscsid() {
|
|||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
all_found=false
|
all_found=false
|
||||||
node=`kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName`
|
node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName)
|
||||||
error "iscsid is not running on $node."
|
error "iscsid is not running on $node."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -321,13 +321,13 @@ check_nfs_client_kernel_support() {
|
|||||||
declare -A nodes=()
|
declare -A nodes=()
|
||||||
|
|
||||||
for pod in ${pods}; do
|
for pod in ${pods}; do
|
||||||
node=`kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName`
|
node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName)
|
||||||
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^# ${config} is not set\" /boot/config-$(uname -r)" > /dev/null 2>&1`
|
res=$(kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^# ${config} is not set\" /boot/config-\$(uname -r)" > /dev/null 2>&1)
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
all_found=false
|
all_found=false
|
||||||
nodes["${node}"]="${node}"
|
nodes["${node}"]="${node}"
|
||||||
else
|
else
|
||||||
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^${config}=\" /boot/config-$(uname -r)" > /dev/null 2>&1`
|
res=$(kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^${config}=\" /boot/config-\$(uname -r)" > /dev/null 2>&1)
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
all_found=false
|
all_found=false
|
||||||
warn "Unable to check kernel config ${config} on node ${node}"
|
warn "Unable to check kernel config ${config} on node ${node}"
|
||||||
|
Loading…
Reference in New Issue
Block a user