diff options
author | Andreas Henriksson | 2014-07-24 21:28:44 +0200 |
---|---|---|
committer | Karel Zak | 2014-07-28 11:09:52 +0200 |
commit | eee79f284382cff628672292e8a0f2bb908ac452 (patch) | |
tree | 7a40e82272bfc66de296198dd479f11bb67ce0b4 /tests/functions.sh | |
parent | mcookie: avoid format warning (diff) | |
download | kernel-qcow2-util-linux-eee79f284382cff628672292e8a0f2bb908ac452.tar.gz kernel-qcow2-util-linux-eee79f284382cff628672292e8a0f2bb908ac452.tar.xz kernel-qcow2-util-linux-eee79f284382cff628672292e8a0f2bb908ac452.zip |
tests: Fall back on host/getent in ts_resolve_host
Neither dig or nslookup would be my first option for resolving,
so add the host utility of ISC/bind fame and the (slow) getent
utility shipped with libc.
This extends the conditions introduced in ...
commit a98de9696e1a898f925c9154e5693e73aec0779d
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
Date: Wed Jun 11 19:28:20 2014 +0200
tests: skip some last tests if no dns support
... and should help us not skip certain tests when we have
network connection but none of dig or nslookup available.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r-- | tests/functions.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh index 6998343e1..59107b010 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -635,6 +635,12 @@ function ts_resolve_host { elif type "nslookup" >/dev/null 2>&1; then tmp=$(nslookup "$host" 2>/dev/null) || return 1 tmp=$(echo "$tmp"| grep -A1 "^Name:"| grep "^Address:"| cut -d" " -f2) + elif type "host" >/dev/null 2>&1; then + tmp=$(host "$host" 2>/dev/null) || return 1 + tmp=$(echo "$tmp" | grep " has address " | cut -d " " -f4) + elif type "getent" >/dev/null 2>&1; then + tmp=$(getent ahosts "$host" 2>/dev/null) || return 1 + tmp=$(echo "$tmp" | cut -d " " -f 1 | sort -u) fi # we return 1 if tmp is empty |