pureslaves now work too

This commit is contained in:
2016-02-22 12:16:03 -05:00
parent 31b1b9ba58
commit db05757b79
10 changed files with 97 additions and 32 deletions

19
bin/add-slave Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/perl
use strict;
use warnings;
use Martnet::DDNS;
use Regexp::Common qw/net/;
my $host = shift || die "No zonename provided";
my $master = shift || die "No master DNS IP provided";
die "Zonename must end in a dot"
unless ($host =~ /^[a-zA-Z0-9\.\-\_]+\.$/);
my $regex = $RE{net}{IPv4} . '|' . $RE{net}{IPv6};
die "Master must be an IPv4 or IPv6 address"
unless ($master =~ /^$regex$/);
my $ddns = Martnet::DDNS->new();
$ddns->add($host, $master, '_pureslave');

View File

@ -17,4 +17,4 @@ die "Master must be an IPv4 or IPv6 address"
unless ($master =~ /^$regex$/);
my $ddns = Martnet::DDNS->new();
$ddns->addvhost($host, $master);
$ddns->add($host, $master, '_vhosts');

14
bin/del-slave Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/perl
use strict;
use warnings;
use Martnet::DDNS;
use Regexp::Common qw/net/;
my $host = shift || die "No zonename provided";
die "Zonename must end in a dot"
unless ($host =~ /^[a-zA-Z0-9\-\_\.]+\.$/);
my $ddns = Martnet::DDNS->new();
$ddns->del($host, '_pureslave');

View File

@ -11,4 +11,4 @@ die "Hostname must end in a dot"
unless ($host =~ /^[a-zA-Z0-9\-\_\.]+\.$/);
my $ddns = Martnet::DDNS->new();
$ddns->delvhost($host);
$ddns->del($host, '_vhosts');

12
bin/list-slaves Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/perl
use strict;
use warnings;
use Martnet::DDNS;
my $ddns = Martnet::DDNS->new();
my @vh = $ddns->get('_pureslave');
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
print $i->{zone}, ". master: ", $i->{master},"\n";
}

View File

@ -6,7 +6,7 @@ use Martnet::DDNS;
my $ddns = Martnet::DDNS->new();
my @vh = $ddns->getvhosts();
my @vh = $ddns->get('_vhosts');
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
print $i->{zone}, ". master: ", $i->{master},"\n";
}

View File

@ -7,7 +7,7 @@ use File::Temp qw/tempfile/;
my $ddns = Martnet::DDNS->new();
my @vh = $ddns->getvhosts();
my @vh = $ddns->get('_vhosts');
# For each virtual host, generate a vhost zone file if there isn't one
my $changecount = 0;