fix defect 3301033 handle when /etc/resolv.conf does not exist or empty or

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9585 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-05-12 17:26:57 +00:00
parent cfc0a0c2a6
commit 57893b9b31

View File

@ -859,12 +859,14 @@ sub initDB
$master = "NORESOLUTION";
}
# get forwarders which are the nameserver entries in /etc/resolv.conf
my $forwarders;
my @names =
xCAT::Utils->runcmd(
"/bin/grep ^[^#]*nameserver /etc/resolv.conf | awk '{print \$2}'",
0);
my $forwarders = join(',', @names);
xCAT::Utils->runcmd(
"/bin/grep ^[^#]*nameserver /etc/resolv.conf | awk '{print \$2}'", -1);
if (@names)
{
$forwarders = join(',', @names);
}
# for policy table
# get hostname from the /etc/xcat/cert/server-cert.pem