diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2017-03-12 19:01:58 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2017-03-12 19:01:58 +0300 |
commit | 814f2355ca14bca1cdad04a923950d4168e5b7bd (patch) | |
tree | 2e20c4abfa057e313249b5cdfe3d20be222ce44e | |
parent | 5df77734649e91bd32fdb57916798930a2afd5cf (diff) |
[NAME-4018] only perform test when /etc/resolv.conf exists
-rw-r--r-- | include/tests_nameservices | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/include/tests_nameservices b/include/tests_nameservices index cce4d07e..a3bd9b92 100644 --- a/include/tests_nameservices +++ b/include/tests_nameservices @@ -90,20 +90,19 @@ Display --indent 2 --text "- Checking search domains" --result "${STATUS_FOUND}" --color GREEN fi fi + # Check amount of search domains (max 1) + FIND=$(${GREPBINARY} -c "^search" ${ROOTDIR}etc/resolv.conf) + if [ ! "${FIND}" = "0" -a ! "${FIND}" = "1" ]; then + LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)" + Display --indent 4 --text "- Checking search domains lines" --result "CONFIG ERROR" --color YELLOW + ReportWarning ${TEST_NO} "Found more than 1 search lines in /etc/resolv.conf, which is probably a misconfiguration" + else + LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)" + fi else LogText "Result: ${ROOTDIR}etc/resolv.conf does not exist, skipping test" Display --indent 2 --text "- Checking search domains" --result "${STATUS_NOT_FOUND}" --color YELLOW fi - - # Check amount of search domains (max 1) - FIND=$(${GREPBINARY} -c "^search" ${ROOTDIR}etc/resolv.conf) - if [ ! "${FIND}" = "0" -a ! "${FIND}" = "1" ]; then - LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)" - Display --indent 4 --text "- Checking search domains lines" --result "CONFIG ERROR" --color YELLOW - ReportWarning ${TEST_NO} "Found more than 1 search lines in /etc/resolv.conf, which is probably a misconfiguration" - else - LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)" - fi fi # ################################################################################# |