From d68bd60d13d6a321b7b3556c7435304f7f1f8231 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 9 Aug 2011 16:39:47 +0000 Subject: [PATCH] add check for search for site.domain in /etc/resolv.conf git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10251 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ddns.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 88424638f..7b49bec3e 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -241,6 +241,7 @@ sub process_request { } my $resolv="/etc/resolv.conf"; my $found=0; + # check if nameserver site.master in /etc/resolv.conf my $nameserver=$master->{value}; my $cmd="grep $nameserver $resolv"; my @output=xCAT::Utils->runcmd($cmd, 0); @@ -258,6 +259,26 @@ sub process_request { if ($found == 0) { # not nameserver master found xCAT::SvrUtils::sendmsg([0,"Warning:The management node is not defined as a nameserver in /etc/resolv.conf. Add \"nameserver $nameserver\" to /etc/resolv.conf and run makedns again."], $callback); } + + # check if search site.domain in /etc/resolv.conf + $found=0; + my $domain=$ctx->{domain}; + my $cmd="grep $domain $resolv"; + my @output=xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $found=0; + } else { # if it is there check it is a search clause + foreach my $line (@output) { + if ($line =~ /^search/) { # line is a search line + $found=1; + last; + } + } + } + if ($found == 0) { # no search site.domain found + xCAT::SvrUtils::sendmsg([0,"Warning:The domain is not defined in a search path in /etc/resolv.conf. Add \"search $domain\" to /etc/resolv.conf and run makedns again."], $callback); + } my $networkstab = xCAT::Table->new('networks',-create=>0); unless ($networkstab) { xCAT::SvrUtils::sendmsg([1,'Unable to enumerate networks, try to run makenetworks'], $callback); }