diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-05-10 18:57:46 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-05-10 18:57:46 +0000 |
commit | 86fdda3479fcba113a209ef2647ed33f972cbdd3 (patch) | |
tree | 207ef846ec90d43a8f87f611d25e68958d139c65 /lib/network/tools.pm | |
parent | 8d0178868b23713be37089235a8348f6f3fef672 (diff) | |
download | drakx-net-86fdda3479fcba113a209ef2647ed33f972cbdd3.tar drakx-net-86fdda3479fcba113a209ef2647ed33f972cbdd3.tar.gz drakx-net-86fdda3479fcba113a209ef2647ed33f972cbdd3.tar.bz2 drakx-net-86fdda3479fcba113a209ef2647ed33f972cbdd3.tar.xz drakx-net-86fdda3479fcba113a209ef2647ed33f972cbdd3.zip |
(connected) fix testing network connectivy test after resolv.conf changes
(Derek Jennings, mga#5772)
Diffstat (limited to 'lib/network/tools.pm')
-rw-r--r-- | lib/network/tools.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 04bd343..8628bc2 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -47,7 +47,15 @@ sub stop_net_interface { stop_interface($net->{net_interface}, $detach); } -sub connected() { gethostbyname("www.mageia.org") ? 1 : 0 } +sub connected() { + if ($::isInstall) { + # gethostbyname() only reads /etc/resolv.conf once so if resolv.conf is + # not present when the test begins, writing it later is not going to help: + symlink "$::prefix/etc/resolv.conf", "/etc/resolv.conf" if ! -e "/etc/resolv.conf"; + return scalar grep { /1 received/ } `$::prefix/bin/ping -qc1 www.mageia.org`; + } + gethostbyname("www.mageia.org") ? 1 : 0; +} # request a ref on a bg_connect and a ref on a scalar sub connected_bg__raw { |