add option to set (r)ndc command
authorivan <ivan>
Fri, 2 Apr 2004 02:09:35 +0000 (02:09 +0000)
committerivan <ivan>
Fri, 2 Apr 2004 02:09:35 +0000 (02:09 +0000)
FS/FS/part_export/bind.pm
bin/bind.export

index cf73ef4..1ef7b65 100644 (file)
@@ -17,7 +17,8 @@ tie %options, 'Tie::IxHash',
                       default => 'BIND8' },
   'bind9_minttl' => { label => 'The minttl required by bind9 and RFC1035.',
                       default => '1D' },
-;
+  'reload'       => { label => 'Optional reload command.  If not specified, defaults to "ndc" under BIND8 and "rndc" under BIND9.', },
+;                    
 
 %info = (
   'svc'     => 'svc_domain',
index 055782a..d0b9379 100755 (executable)
@@ -30,6 +30,11 @@ foreach my $export ( @exports ) {
   my $machine = $export->machine;
   my $prefix = "$spooldir/$machine";
 
+  my $bind_rel = $export->option('bind_release');
+  my $ndc_cmd = $export->option('reload')
+                || ( ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc' );
+  my $minttl = $export->option('bind9_minttl');
+
   #prevent old domain files from piling up
   #rmtree "$prefix" or die "can't rmtree $prefix.db: $!";
 
@@ -79,6 +84,10 @@ END
       open (DB_MASTER,">$prefix/db.$domain")
         or die "can't open $prefix/db.$domain: $!";
 
+      if ($bind_rel eq 'BIND9') {
+        print DB_MASTER "\$TTL $minttl\n\$ORIGIN $domain.\n";
+      }
+
       my @domain_records =
         qsearch('domain_record', { 'svcnum' => $svc_domain->svcnum } );
       foreach my $domain_record (
@@ -114,7 +123,7 @@ END
   } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
 #  warn $rsync->out;
 
-  ssh("root\@$machine", 'ndc reload');
+  ssh("root\@$machine", "$ndc_cmd reload");
 
 }
 
@@ -125,6 +134,9 @@ foreach my $sexport ( @sexports ) { #false laziness with above
   my $machine = $sexport->machine;
   my $prefix = "$spooldir/$machine";
 
+  my $bind_rel = $sexport->option('bind_release');
+  my $ndc_cmd = ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc';
+
   #prevent old domain files from piling up
   #rmtree "$prefix" or die "can't rmtree $prefix.db: $!";
 
@@ -166,7 +178,7 @@ END
   } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
 #  warn $rsync->out;
 
-  ssh("root\@$machine", 'ndc reload');
+  ssh("root\@$machine", "$ndc_cmd reload");
 
 }
 close NAMED_CONF;