diff options
author | ivan <ivan> | 2010-08-17 17:08:22 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-08-17 17:08:22 +0000 |
commit | 9bdca2fe23584918219395b62effbb9ef0fc5f1c (patch) | |
tree | 3d9127c06721544c8941f74088abed2679b96329 /FS/FS | |
parent | 96ae2087c30bbe8f4db97879c105843bdd3fc295 (diff) |
DNS, RT#8933
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/domain_record.pm | 12 | ||||
-rw-r--r-- | FS/FS/svc_domain.pm | 32 |
3 files changed, 46 insertions, 5 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c436413..fe010f7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1308,7 +1308,12 @@ and customer address. Include units.', 'editlist_parts' => [ { type=>'text' }, { type=>'immutable', value=>'IN' }, { type=>'select', - select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} }, + select_enum => { + map { $_=>$_ } + #@{ FS::domain_record->rectypes } + qw(A AAAA CNAME MX NS PTR SPF SRV TXT) + }, + }, { type=> 'text' }, ], }, diff --git a/FS/FS/domain_record.pm b/FS/FS/domain_record.pm index 6513abf..e7e9f70 100644 --- a/FS/FS/domain_record.pm +++ b/FS/FS/domain_record.pm @@ -419,6 +419,18 @@ sub reverse_record { or new FS::domain_record { %hash, 'recdata' => $self->zone.'.' }; } +=item rectypes + +=cut +#http://en.wikipedia.org/wiki/List_of_DNS_record_types +#DHCID? other things? +sub rectypes { + [ qw(A AAAA CNAME MX NS PTR SPF SRV TXT), #most common types + #qw(DNAME), #uncommon types + qw(DLV DNSKEY DS NSEC NSEC3 NSEC3PARAM RRSIG), #DNSSEC types + ]; +} + =back =head1 BUGS diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm index 3dc352b..7d527e5 100644 --- a/FS/FS/svc_domain.pm +++ b/FS/FS/svc_domain.pm @@ -341,12 +341,36 @@ sub insert { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - $error = $self->SUPER::insert(@_); + $error = $self->SUPER::insert(@_) + || $self->insert_defaultrecords; if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + + ''; #no error +} + +=item insert_defaultrecords + +=cut + +sub insert_defaultrecords { + my $self = shift; + + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + if ( $soamachine ) { my $soa = new FS::domain_record { 'svcnum' => $self->svcnum, @@ -356,10 +380,10 @@ sub insert { 'recdata' => "$soamachine $soaemail ( ". time2str("%Y%m%d", time). "00 ". "$soarefresh $soaretry $soaexpire $soadefaultttl )" }; - $error = $soa->insert; + my $error = $soa->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "couldn't insert SOA record for new domain: $error"; + return "couldn't insert SOA record: $error"; } foreach my $record ( @defaultrecords ) { @@ -374,7 +398,7 @@ sub insert { my $error = $domain_record->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "couldn't insert record for new domain: $error"; + return "couldn't insert record: $error"; } } |