Handle the case where networks.nameservers is a comma delimited list

This commit is contained in:
sjing 2013-10-24 04:13:55 -04:00
parent 07ee30b7bb
commit 2ff2cfe4e2

View File

@ -295,14 +295,23 @@ sub process_request {
my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers');
# exclude the net if it is using an external dns server.
foreach (@networks)
foreach my $net (@networks)
{
if ($_ and $_->{nameservers})
if ($net and $net->{nameservers})
{
my $myip = xCAT::NetworkUtils->my_ip_facing($_->{net});
unless (($_->{nameservers} eq $myip) || ($_->{nameservers} eq '<xcatmaster>') || ($_->{nameservers} eq $sitens))
my $valid = 0;
my $myip = xCAT::NetworkUtils->my_ip_facing($net->{net});
foreach (split /,/, $net->{nameservers})
{
$_ = undef;
chomp $_;
if (($_ eq $myip) || ($_ eq '<xcatmaster>') || ($_ eq $sitens))
{
$valid += 1;
}
}
unless ($valid > 0)
{
$net = undef;
}
}
}