2014-01-20 01:08:03 +01:00
|
|
|
use v5.14;
|
|
|
|
package app::zone::rndc_interface;
|
|
|
|
use Moose;
|
|
|
|
|
2014-05-08 00:45:12 +02:00
|
|
|
has [ qw/data/ ] => qw/is ro required 1/;
|
|
|
|
|
2014-01-20 01:08:03 +01:00
|
|
|
# on suppose que tout est déjà mis à jour dans le fichier
|
|
|
|
sub reload {
|
|
|
|
my ($self, $zname) = @_;
|
|
|
|
system("rndc reload $zname 2>/dev/null 1>/dev/null");
|
2014-05-08 18:19:29 +02:00
|
|
|
system("rndc notify $zname 2>/dev/null 1>/dev/null");
|
2014-01-20 01:08:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub addzone {
|
|
|
|
my ($self, $zdir, $zname, $opt) = @_;
|
|
|
|
|
|
|
|
my $command = "rndc addzone $zname ";
|
|
|
|
|
|
|
|
if(defined $opt) {
|
|
|
|
$command .= "'$opt'";
|
|
|
|
}
|
|
|
|
else {
|
2014-05-08 17:44:55 +02:00
|
|
|
$command .= "'{ type master; file \"$zdir/$zname\"; allow-transfer { ". $self->data->nsslavev4 . '; '. $self->data->nsslavev6 . "; }; notify yes; };'";
|
2014-01-20 01:08:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$command .= " 2>/dev/null 1>/dev/null";
|
|
|
|
system($command);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sub reconfig {
|
|
|
|
my ($self, $zname) = @_;
|
|
|
|
system("rndc reconfig 2>/dev/null 1>/dev/null");
|
|
|
|
}
|
|
|
|
|
|
|
|
sub delzone {
|
|
|
|
my ($self, $zdir, $zname) = @_;
|
|
|
|
system("rndc delzone $zname 2>/dev/null 1>/dev/null");
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|