updates for more flags
This commit is contained in:
23
DDNS.pm
23
DDNS.pm
@@ -235,6 +235,27 @@ sub type {
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
# Set (create or replace) an existing control-plane record. This is used by
|
||||
# the add-* scripts when --edit is specified.
|
||||
# It deletes the existing TXT RDATA for the fqdn and writes the new value.
|
||||
sub set {
|
||||
my ($this, $dom, $value, $type) = @_;
|
||||
_validateOrDie($dom);
|
||||
my $fqdn = _fqdn($dom, $type);
|
||||
|
||||
# If it doesn't exist, fail explicitly; callers can decide whether to add.
|
||||
my $existingtype = $this->type($dom);
|
||||
die "Domain $dom does not exist; cannot edit"
|
||||
unless $existingtype;
|
||||
die "Domain $dom exists as type $existingtype; cannot edit as $type"
|
||||
if (defined $type && $existingtype ne $type);
|
||||
|
||||
$this->__docmd("update delete $fqdn TXT");
|
||||
$this->__docmd("update add $fqdn 60 TXT " . _quote_txt_rdata($value));
|
||||
$this->cleanup();
|
||||
}
|
||||
|
||||
sub add {
|
||||
my ($this, $dom, $master, $type) = @_;
|
||||
_validateOrDie($dom);
|
||||
@@ -270,7 +291,7 @@ sub cleanup {
|
||||
# Merge the .jnl file in with the domain file
|
||||
system("rndc sync -clean private.invalid");
|
||||
# Rebuild and reload the master vhosts files
|
||||
system("/usr/local/bin/sync-master-vhosts");
|
||||
system("/usr/local/bin/sync-unified-master");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user