From df3eb6c4f48b9dd7ddc911e50065ea6df533ae11 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 18 Jan 2018 01:44:29 -0500 Subject: [PATCH 1/4] change empty_zones_enable in named.conf --- perl-xCAT/xCAT/Schema.pm | 1 + xCAT-server/lib/xcat/plugins/ddns.pm | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 02760f105..42b309c6e 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1057,6 +1057,7 @@ passed as argument rather than by table value', " requests it does not know to these servers. Note that the DNS servers on the\n" . " service nodes will ignore this value and always be configured to forward \n" . " to the management node.\n\n" . +" emptyzonesenable: (yes or no). This is to set empty-zones-enable value in named.conf options section. The default is yes. \n\n" " master: The hostname of the xCAT management node, as known by the nodes.\n\n" . " nameservers: A comma delimited list of DNS servers that each node in the cluster should\n" . " use. This value will end up in the nameserver settings of the\n" . diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 026e55bd8..f59fb1f04 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -587,6 +587,11 @@ sub process_request { $ctx->{forwarders} = \@forwarders; } + my @options = xCAT::TableUtils->get_site_attribute("emptyzonesenable"); + my $empty_zones = $options[0]; + if (defined($empty_zones) and $empty_zones =~ /^yes$|^no$/) { + $ctx->{empty_zones_enable} = $empty_zones; + } my @slave_ips; my $dns_slaves = get_dns_slave(); if (scalar @$dns_slaves) { @@ -1098,6 +1103,9 @@ sub update_namedconf { push @newnamed, "\t\t" . $_ . ";\n"; } push @newnamed, "\t};\n"; + } elsif ($ctx->{empty_zones_enable} and $line =~ /empty-zones-enable/) { + push @newnamed, "\tempty-zones-enable " . $_ . ";\n"; + $skip = 1; } elsif ($ctx->{slaves} and $line =~ /allow-transfer \{/) { push @newnamed, "\tallow-transfer \{\n"; $skip = 1; @@ -1237,6 +1245,10 @@ sub update_namedconf { push @newnamed, "\t};\n"; } + if ($ctx->{empty_zones_enable}){ + push @newnamed, "\tempty-zones-enable " . $ctx->{empty_zones_enable} . ";\n"; + } + if ($slave) { push @newnamed, "\tallow-transfer { any; };\n"; } else { From 7f7c4e4deaf28ed31f834882146ae30169af3470 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 18 Jan 2018 02:36:31 -0500 Subject: [PATCH 2/4] enhance print error message --- xCAT-server/lib/xcat/plugins/ddns.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index f59fb1f04..d2b5a9812 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -589,8 +589,14 @@ sub process_request { my @options = xCAT::TableUtils->get_site_attribute("emptyzonesenable"); my $empty_zones = $options[0]; - if (defined($empty_zones) and $empty_zones =~ /^yes$|^no$/) { - $ctx->{empty_zones_enable} = $empty_zones; + if (defined($empty_zones)) { + if ($empty_zones =~ /^yes$|^no$/) { + $ctx->{empty_zones_enable} = $empty_zones; + } else { + my $rsp; + push @{ $rsp->{data} }, "emptyzonesenable from xCAT site table should be yes or no."; + xCAT::MsgUtils->message("E", $rsp, $callback); + } } my @slave_ips; my $dns_slaves = get_dns_slave(); @@ -1104,8 +1110,7 @@ sub update_namedconf { } push @newnamed, "\t};\n"; } elsif ($ctx->{empty_zones_enable} and $line =~ /empty-zones-enable/) { - push @newnamed, "\tempty-zones-enable " . $_ . ";\n"; - $skip = 1; + push @newnamed, "\tempty-zones-enable " . $ctx->{empty_zones_enable} . ";\n"; } elsif ($ctx->{slaves} and $line =~ /allow-transfer \{/) { push @newnamed, "\tallow-transfer \{\n"; $skip = 1; From 988898dde1ee5d951fa9181e4634766194dee7e7 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 18 Jan 2018 02:58:30 -0500 Subject: [PATCH 3/4] enhance emptyzonesenable description --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 42b309c6e..0bb0b52d9 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1057,7 +1057,7 @@ passed as argument rather than by table value', " requests it does not know to these servers. Note that the DNS servers on the\n" . " service nodes will ignore this value and always be configured to forward \n" . " to the management node.\n\n" . -" emptyzonesenable: (yes or no). This is to set empty-zones-enable value in named.conf options section. The default is yes. \n\n" +" emptyzonesenable: (yes or no). This is to set empty-zones-enable value in named.conf options section. \n\n" " master: The hostname of the xCAT management node, as known by the nodes.\n\n" . " nameservers: A comma delimited list of DNS servers that each node in the cluster should\n" . " use. This value will end up in the nameserver settings of the\n" . From 55fed03a8166a33458d3e9f549960fe62341192c Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 18 Jan 2018 03:01:45 -0500 Subject: [PATCH 4/4] handle error --- xCAT-server/lib/xcat/plugins/ddns.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index d2b5a9812..903c3aea5 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -595,7 +595,8 @@ sub process_request { } else { my $rsp; push @{ $rsp->{data} }, "emptyzonesenable from xCAT site table should be yes or no."; - xCAT::MsgUtils->message("E", $rsp, $callback); + xCAT::MsgUtils->message("E", $rsp, $callback); + return; } } my @slave_ips;