diff options
author | Andreas Stieger <andreasstieger@users.noreply.github.com> | 2016-05-30 20:20:37 +0300 |
---|---|---|
committer | Michael Boelen <michael@cisofy.com> | 2016-05-30 20:20:37 +0300 |
commit | ece464b1daef80c7bc6cf533da85e8ddba9d411b (patch) | |
tree | 72481536f2b3b8ba9ff88087d432d3af3e0df1cb /include/tests_ports_packages | |
parent | 000077d3791041311bcaf047fc4d3acf033a27e2 (diff) |
improve non-interactive use of zypper (#208)
* PKGS-7328: only list installed items of type package
Otherwise the package list may contain duplicate items of type application or patch
Signed-off-by: Andreas Stieger <astieger@suse.com>
* PKGS-7328, PKGS-7330: run zypper with non-interactive flag
Otherwise the test will hang if zypper issues an interactive query or warning,
such as for new/changed keys, network issues or other errors.
Signed-off-by: Andreas Stieger <astieger@suse.com>
Diffstat (limited to 'include/tests_ports_packages')
-rw-r--r-- | include/tests_ports_packages | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/tests_ports_packages b/include/tests_ports_packages index 482cbb17..af1d676a 100644 --- a/include/tests_ports_packages +++ b/include/tests_ports_packages @@ -285,7 +285,7 @@ N=0 PACKAGE_AUDIT_TOOL_FOUND=1 PACKAGE_AUDIT_TOOL="zypper" - FIND=`${ZYPPERBINARY} se -i | awk '{ if ($1=="i") { print $3 } }'` + FIND=`${ZYPPERBINARY} se -n -t package -i | awk '{ if ($1=="i") { print $3 } }'` if [ ! "${FIND}" = "" ]; then for I in ${FIND}; do N=$((N + 1)) @@ -306,7 +306,7 @@ if [ ! "${ZYPPERBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi Register --test-no PKGS-7330 --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying Zypper for vulnerable packages" if [ ${SKIPTEST} -eq 0 ]; then - FIND=`${ZYPPERBINARY} pchk | grep "(0 security patches)"` + FIND=`${ZYPPERBINARY} -n pchk | grep "(0 security patches)"` if [ ! "${FIND}" = "" ]; then LogText "Result: No security updates found with Zypper" Display --indent 2 --text "- Using Zypper to find vulnerable packages" --result NONE --color GREEN @@ -315,7 +315,7 @@ LogText "Result: Zypper found one or more installed packages which are vulnerable." ReportWarning ${TEST_NO} "H" "Found one or more vulnerable packages installed" # Unfortunately zypper does not properly give back which package it is. Usually best guess is last word on the line - FIND=`${ZYPPERBINARY} lp | ${AWKBINARY} '{ if ($5=="security" || $7=="security") { print $NF }}' | sed 's/:$//' | grep -v "^$" | sort -u` + FIND=`${ZYPPERBINARY} -n lp | ${AWKBINARY} '{ if ($5=="security" || $7=="security") { print $NF }}' | sed 's/:$//' | grep -v "^$" | sort -u` LogText "List of vulnerable packages/version:" for I in ${FIND}; do VULNERABLE_PACKAGES_FOUND=1 |