diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2017-04-30 18:59:35 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2017-04-30 18:59:35 +0300 |
commit | 4ecb9d4d05124b813cd4d7ddcaf5671c2f4c4765 (patch) | |
tree | 282f5a4e9e3530ada04d00bda3e8ac118cf70bbd /include/tests_logging | |
parent | 5ccd0912cf74f5d3dd07e5ed5fe0e6a30571fbb5 (diff) |
[bulk change] cleaning up, code enhancements, initialization of variables, and new tests
Diffstat (limited to 'include/tests_logging')
-rw-r--r-- | include/tests_logging | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/tests_logging b/include/tests_logging index 26930809..819f5436 100644 --- a/include/tests_logging +++ b/include/tests_logging @@ -281,21 +281,21 @@ # # Test : LOGG-2150 # Description : Checking log directories rotated with logrotate - if [ ! "${LOGROTATEBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi + if HasData "${LOGROTATEBINARY}"; then PREQS_MET="YES"; else PREQS_MET="NO"; fi Register --test-no LOGG-2150 --weight L --preqs-met ${PREQS_MET} --network NO --category security --description "Checking directories in logrotate configuration" if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: Checking which directories can be found in logrotate configuration" - FIND=$(${LOGROTATEBINARY} -d -v /etc/logrotate.conf 2>&1 | ${EGREPBINARY} "considering log|skipping" | ${GREPBINARY} -v '*' | ${SORTBINARY} -u | ${AWKBINARY} '{ if ($2=="log") { print $3 } }' | ${SEDBINARY} 's@/[^/]*$@@g' | ${SORTBINARY} -u) - if [ "${FIND}" = "" ]; then + FIND=$(${LOGROTATEBINARY} -d -v ${ROOTDIR}etc/logrotate.conf 2>&1 | ${EGREPBINARY} "considering log|skipping" | ${GREPBINARY} -v '*' | ${SORTBINARY} -u | ${AWKBINARY} '{ if ($2=="log") { print $3 } }' | ${SEDBINARY} 's@/[^/]*$@@g' | ${SORTBINARY} -u) + if IsEmpty "${FIND}" ]; then LogText "Result: nothing found" - else + else LogText "Result: found one or more directories (via logrotate configuration)" - for I in ${FIND}; do - if [ -d ${I} ]; then - LogText "Directory found: ${I}" - Report "log_directory[]=${I}" - else - LogText "Directory could not be found: ${I}" + for DIR in ${FIND}; do + if [ -d ${DIR} ]; then + LogText "Directory found: ${DIR}" + Report "log_directory[]=${DIR}" + else + LogText "Result: Directory could not be found: ${DIR}" fi done fi @@ -379,7 +379,7 @@ AddHP 5 5 Display --indent 2 --text "- Checking remote logging" --result "${STATUS_ENABLED}" --color GREEN fi - else + else LogText "Result: test skipped, file ${SYSLOGD_CONF} not found" fi fi |