[PKGS-7420] limit test to specific OS, add dnf-automatic support, extend logging

This commit is contained in:
Michael Boelen 2019-03-30 13:31:03 +01:00
parent abaed3e6c1
commit 3660043308
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04

View File

@ -1284,35 +1284,57 @@
if [ ${SKIPTEST} -eq 0 ]; then if [ ${SKIPTEST} -eq 0 ]; then
UNATTENDED_UPGRADES_TOOLKIT=0 UNATTENDED_UPGRADES_TOOLKIT=0
UNATTENDED_UPGRADES_TOOL="" UNATTENDED_UPGRADES_TOOL=""
if [ -f "${ROOTDIR}bin/auter" ]; then UNATTENDED_UPGRADES_OPTION_AVAILABLE=0
UNATTENDED_UPGRADES_TOOL="auter"
UNATTENDED_UPGRADES_TOOLKIT=1 case "${OS}" in
LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}" "Linux")
Report "unattended_upgrade_tool[]=auter" case "${LINUX_VERSION}" in
fi "CentOS" | "Debian" | "Fedora" | "RHEL" | "Ubuntu")
if [ -f "${ROOTDIR}sbin/yum-cron" ]; then
UNATTENDED_UPGRADES_TOOL="yum-cron" UNATTENDED_UPGRADES_OPTION_AVAILABLE=1
UNATTENDED_UPGRADES_TOOLKIT=1 # Test available tools for Linux
LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}" if [ -f "${ROOTDIR}bin/auter" ]; then
Report "unattended_upgrade_tool[]=yum-cron" UNATTENDED_UPGRADES_TOOL="auter"
fi UNATTENDED_UPGRADES_TOOLKIT=1
if [ -f "${ROOTDIR}usr/bin/unattended-upgrade" ]; then LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
UNATTENDED_UPGRADES_TOOL="unattended-upgrade" Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
UNATTENDED_UPGRADES_TOOLKIT=1 fi
LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}" if [ -f "${ROOTDIR}sbin/yum-cron" ]; then
Report "unattended_upgrade_tool[]=unattended-upgrade" UNATTENDED_UPGRADES_TOOL="yum-cron"
fi UNATTENDED_UPGRADES_TOOLKIT=1
if [ ${UNATTENDED_UPGRADES_TOOLKIT} -eq 1 ]; then LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
AddHP 5 5 Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
Display --indent 2 --text "- Toolkit for automatic upgrades (${UNATTENDED_UPGRADES_TOOL})" --result "${STATUS_FOUND}" --color GREEN fi
else if [ -f "${ROOTDIR}usr/bin/dnf-automatic" ]; then
# TODO - Add logic to only display this when it is applicable as not all operating systems might support such tooling UNATTENDED_UPGRADES_TOOL="dnf-automatic"
AddHP 1 5 UNATTENDED_UPGRADES_TOOLKIT=1
Display --indent 2 --text "- Toolkit for automatic upgrades" --result "${STATUS_NOTFOUND}" --color YELLOW LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
LogText "Result: no toolkit for automatic updates discovered" Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
# TODO - add suggestion fi
if [ -f "${ROOTDIR}usr/bin/unattended-upgrade" ]; then
UNATTENDED_UPGRADES_TOOL="unattended-upgrade"
UNATTENDED_UPGRADES_TOOLKIT=1
LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
fi
;;
esac
;;
esac
if [ ${UNATTENDED_UPGRADES_OPTION_AVAILABLE} -eq 1 ]; then
if [ ${UNATTENDED_UPGRADES_TOOLKIT} -eq 1 ]; then
AddHP 5 5
Display --indent 2 --text "- Toolkit for automatic upgrades (${UNATTENDED_UPGRADES_TOOL})" --result "${STATUS_FOUND}" --color GREEN
else
AddHP 1 5
Display --indent 2 --text "- Toolkit for automatic upgrades" --result "${STATUS_NOTFOUND}" --color YELLOW
LogText "Result: no toolkit for automatic updates discovered"
ReportSuggestion "${TEST_NO}" "Consider using a tool to automatically apply upgrades"
fi
fi fi
Report "unattended_upgrade_option_avaiable=${UNATTENDED_UPGRADES_OPTION_AVAILABLE}"
fi fi
# #
################################################################################# #################################################################################