Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0

reload_sec: suppression addzone_sec et delzone_sec

master
Philippe Pittoli 2014-05-08 14:35:06 +02:00
parent feedeac9f9
commit ce23f60fa6
2 changed files with 25 additions and 17 deletions

View File

@ -59,7 +59,7 @@ sub addzone {
# add new zone on the secondary ns # add new zone on the secondary ns
my $sec = app::zone::interface->new() my $sec = app::zone::interface->new()
->get_interface($self->data->dnsappsec, $self->data); ->get_interface($self->data->dnsappsec, $self->data);
$sec->addzone_sec($self->data->zdir, $self->zname); $sec->reload_sec();
return $zonefile; return $zonefile;
} }
@ -178,8 +178,7 @@ sub del {
my $sec = app::zone::interface->new() my $sec = app::zone::interface->new()
->get_interface($self->data->dnsappsec, $self->data); ->get_interface($self->data->dnsappsec, $self->data);
$sec->delzone($self->data->zdir, $self->zname); $sec->reload_sec();
$sec->reload($self->data->zdir, $self->zname);
my $file = $self->data->zdir.'/'.$self->zname; my $file = $self->data->zdir.'/'.$self->zname;
my $host = $self->data->sshhost; my $host = $self->data->sshhost;

View File

@ -5,15 +5,22 @@ use Moose;
has [ qw/data/ ] => qw/is ro required 1/; has [ qw/data/ ] => qw/is ro required 1/;
# on suppose que tout est déjà mis à jour dans le fichier # on suppose que tout est déjà mis à jour dans le fichier
sub reload { sub reload_sec {
my ($self, $zname) = @_; my ($self) = @_;
system("ssh "
. $self->data->sshhostsec $self->_reload_conf();
. " nsdc reload $zname 2>/dev/null 1>/dev/null");
system('ssh -p ' . $self->data->sshportsec . ' '
. $self->data->sshusersec . '@' . $self->data->sshhostsec
. ' sudo nsdc rebuild 2>/dev/null 1>/dev/null');
system('ssh ' . $self->data->sshportsec . ' '
. $self->data->sshusersec . '@' . $self->data->sshhostsec
. ' sudo nsdc reload 2>/dev/null 1>/dev/null');
} }
sub addzone_sec { sub _reload_conf {
my ($self, $zdir, $zname, $opt) = @_; my ($self) = @_;
# get the file # get the file
# modify the file # modify the file
@ -30,16 +37,16 @@ sub addzone_sec {
my $data = read_file($f); my $data = read_file($f);
my $debut = "## BEGIN_GENERATED"; my $debut = "## BEGIN_GENERATED";
my $nouveau = ''; # TODO my $nouveau = '';
for(keys %slavedzones) { for(keys %slavedzones) {
$nouveau .= "zone:\n\tname: \"$_\"\n" $nouveau .= "zone:\n\n\tname: \"$_\"\n"
. "\tzonefile: \"slave/$_\"\n"; . "\tzonefile: \"slave/$_\"\n\n";
# allow notify & request xfr, v4 & v6 # allow notify & request xfr, v4 & v6
$nouveau .= $nouveau .=
"\tallow-notify: " . $self->data->nsmasterv4 . ' ' . $self->data->dnsslavekey . "\n" "\tallow-notify: " . $self->data->nsmasterv4 . ' ' . $self->data->dnsslavekey . "\n"
. "\trequest-xfr: " . $self->data->nsmasterv4 . ' ' . $self->data->dnsslavekey . "\n"; . "\trequest-xfr: " . $self->data->nsmasterv4 . ' ' . $self->data->dnsslavekey . "\n\n";
$nouveau .= $nouveau .=
"\tallow-notify: " . $self->data->nsmasterv6. ' ' . $self->data->dnsslavekey . "\n" "\tallow-notify: " . $self->data->nsmasterv6. ' ' . $self->data->dnsslavekey . "\n"
@ -75,12 +82,14 @@ sub _scp_put {
sub reconfig { sub reconfig {
my ($self, $zname) = @_; my ($self, $zname) = @_;
system("nsdc reconfig 2>/dev/null 1>/dev/null"); die "not implemented";
#system("nsdc reconfig 2>/dev/null 1>/dev/null");
} }
sub delzone { sub delzone {
my ($self, $zdir, $zname) = @_; my ($self) = @_;
system("nsdc delzone $zname 2>/dev/null 1>/dev/null"); die "not implemented";
#system("nsdc delzone $zname 2>/dev/null 1>/dev/null");
} }
sub read_file { sub read_file {