From 2ff2cfe4e2ea5a8fff8874e1e9b14b48e92726c2 Mon Sep 17 00:00:00 2001 From: sjing Date: Thu, 24 Oct 2013 04:13:55 -0400 Subject: [PATCH] Handle the case where networks.nameservers is a comma delimited list --- xCAT-server/lib/xcat/plugins/ddns.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 78d655e3a..6516d25ad 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -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 '') || ($_->{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 '') || ($_ eq $sitens)) + { + $valid += 1; + } + } + unless ($valid > 0) + { + $net = undef; } } }