mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@@ -70,13 +70,13 @@ func (c *api) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correctio
|
||||
}
|
||||
models.PostProcessRecords(existing)
|
||||
clean := PrepFoundRecords(existing)
|
||||
var min_ttl uint32
|
||||
var minTTL uint32
|
||||
if ttl, ok := c.domainIndex[dc.Name]; !ok {
|
||||
min_ttl = 3600
|
||||
minTTL = 3600
|
||||
} else {
|
||||
min_ttl = ttl
|
||||
minTTL = ttl
|
||||
}
|
||||
PrepDesiredRecords(dc, min_ttl)
|
||||
PrepDesiredRecords(dc, minTTL)
|
||||
return c.GenerateDomainCorrections(dc, clean)
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ func PrepFoundRecords(recs models.Records) models.Records {
|
||||
}
|
||||
|
||||
// PrepDesiredRecords munges any records to best suit this provider.
|
||||
func PrepDesiredRecords(dc *models.DomainConfig, min_ttl uint32) {
|
||||
func PrepDesiredRecords(dc *models.DomainConfig, minTTL uint32) {
|
||||
// Sort through the dc.Records, eliminate any that can't be
|
||||
// supported; modify any that need adjustments to work with the
|
||||
// provider. We try to do minimal changes otherwise it gets
|
||||
@@ -130,11 +130,11 @@ func PrepDesiredRecords(dc *models.DomainConfig, min_ttl uint32) {
|
||||
printer.Warnf("deSEC does not support alias records\n")
|
||||
continue
|
||||
}
|
||||
if rec.TTL < min_ttl {
|
||||
if rec.TTL < minTTL {
|
||||
if rec.Type != "NS" {
|
||||
printer.Warnf("Please contact support@desec.io if you need ttls < %d. Setting ttl of %s type %s from %d to %d\n", min_ttl, rec.GetLabelFQDN(), rec.Type, rec.TTL, min_ttl)
|
||||
printer.Warnf("Please contact support@desec.io if you need ttls < %d. Setting ttl of %s type %s from %d to %d\n", minTTL, rec.GetLabelFQDN(), rec.Type, rec.TTL, minTTL)
|
||||
}
|
||||
rec.TTL = min_ttl
|
||||
rec.TTL = minTTL
|
||||
}
|
||||
recordsToKeep = append(recordsToKeep, rec)
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func PrepDesiredRecords(dc *models.DomainConfig, min_ttl uint32) {
|
||||
// a list of functions to call to actually make the desired
|
||||
// correction, and a message to output to the user when the change is
|
||||
// made.
|
||||
func (client *api) GenerateDomainCorrections(dc *models.DomainConfig, existing models.Records) ([]*models.Correction, error) {
|
||||
func (c *api) GenerateDomainCorrections(dc *models.DomainConfig, existing models.Records) ([]*models.Correction, error) {
|
||||
|
||||
var corrections = []*models.Correction{}
|
||||
|
||||
@@ -207,7 +207,7 @@ func (client *api) GenerateDomainCorrections(dc *models.DomainConfig, existing m
|
||||
Msg: msg,
|
||||
F: func() error {
|
||||
rc := rrs
|
||||
err := client.upsertRR(rc, dc.Name)
|
||||
err := c.upsertRR(rc, dc.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -82,14 +82,14 @@ func (c *api) fetchDomainList() error {
|
||||
func (c *api) getRecords(domain string) ([]resourceRecord, error) {
|
||||
endpoint := "/domains/%s/rrsets/"
|
||||
var rrs []rrResponse
|
||||
var rrs_new []resourceRecord
|
||||
var rrsNew []resourceRecord
|
||||
var bodyString, err = c.get(fmt.Sprintf(endpoint, domain), "GET")
|
||||
if err != nil {
|
||||
return rrs_new, fmt.Errorf("Error fetching records from deSEC for domain %s: %s", domain, err)
|
||||
return rrsNew, fmt.Errorf("Error fetching records from deSEC for domain %s: %s", domain, err)
|
||||
}
|
||||
err = json.Unmarshal(bodyString, &rrs)
|
||||
if err != nil {
|
||||
return rrs_new, err
|
||||
return rrsNew, err
|
||||
}
|
||||
// deSEC returns round robin records as array but dnsconfig expects single entries for each record
|
||||
// we will create one object per record except of TXT records which are handled as array of string by dnscontrol aswell.
|
||||
@@ -100,9 +100,9 @@ func (c *api) getRecords(domain string) ([]resourceRecord, error) {
|
||||
Subname: rrs[i].Subname,
|
||||
Records: rrs[i].Records,
|
||||
}
|
||||
rrs_new = append(rrs_new, tmp)
|
||||
rrsNew = append(rrsNew, tmp)
|
||||
}
|
||||
return rrs_new, nil
|
||||
return rrsNew, nil
|
||||
}
|
||||
|
||||
func (c *api) createDomain(domain string) error {
|
||||
|
Reference in New Issue
Block a user