mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
MAINT: Unify provider outputs to pkg/printer (#1546)
* Unify provider outputs to pkg/printer Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me> * No need for custom Errorf Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me> * Add missing import for activedir Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me> * Add missing fmt import for activedir Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>
This commit is contained in:
committed by
GitHub
parent
ba2c7f9c0e
commit
bcb968411a
@@ -168,9 +168,9 @@ func oneLabel(records models.Records) yaml.MapItem {
|
||||
if v.Type == "TXT" {
|
||||
v.Value = strings.Replace(models.StripQuotes(v.Value), `;`, `\;`, -1)
|
||||
}
|
||||
//fmt.Printf("yamlwrite:oneLabel: simple ttl=%d\n", v.TTL)
|
||||
//printer.Printf("yamlwrite:oneLabel: simple ttl=%d\n", v.TTL)
|
||||
item.Value = v
|
||||
//fmt.Printf("yamlwrite:oneLabel: SIMPLE=%v\n", item)
|
||||
//printer.Printf("yamlwrite:oneLabel: SIMPLE=%v\n", item)
|
||||
return item
|
||||
case "MX", "SRV":
|
||||
// Always processed as a complex{}
|
||||
@@ -191,7 +191,7 @@ func oneLabel(records models.Records) yaml.MapItem {
|
||||
v.Values = append(v.Values, rec.GetTargetField())
|
||||
}
|
||||
item.Value = v
|
||||
//fmt.Printf("SIMPLE=%v\n", item)
|
||||
//printer.Printf("SIMPLE=%v\n", item)
|
||||
return item
|
||||
case "MX", "SRV":
|
||||
// Always processed as a complex{}
|
||||
@@ -207,14 +207,14 @@ func oneLabel(records models.Records) yaml.MapItem {
|
||||
var last = records[0].Type
|
||||
for i := range records {
|
||||
if records[i].Type != last {
|
||||
//fmt.Printf("yamlwrite:oneLabel: Calling oneType( [%d:%d] ) last=%s type=%s\n", low, i, last, records[0].Type)
|
||||
//printer.Printf("yamlwrite:oneLabel: Calling oneType( [%d:%d] ) last=%s type=%s\n", low, i, last, records[0].Type)
|
||||
lst = append(lst, oneType(records[low:i]))
|
||||
low = i // Current is the first of a run.
|
||||
last = records[i].Type
|
||||
}
|
||||
if i == (len(records) - 1) {
|
||||
// we are on the last element.
|
||||
//fmt.Printf("yamlwrite:oneLabel: Calling oneType( [%d:%d] ) last=%s type=%s\n", low, i+1, last, records[0].Type)
|
||||
//printer.Printf("yamlwrite:oneLabel: Calling oneType( [%d:%d] ) last=%s type=%s\n", low, i+1, last, records[0].Type)
|
||||
lst = append(lst, oneType(records[low:i+1]))
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ func oneLabel(records models.Records) yaml.MapItem {
|
||||
// oneType returns interfaces that will MarshalYAML properly for a label with
|
||||
// one or more records, all the same rtype.
|
||||
func oneType(records models.Records) interface{} {
|
||||
//fmt.Printf("yamlwrite:oneType len=%d type=%s\n", len(records), records[0].Type)
|
||||
//printer.Printf("yamlwrite:oneType len=%d type=%s\n", len(records), records[0].Type)
|
||||
rtype := records[0].Type
|
||||
switch rtype {
|
||||
case "A", "AAAA", "NS":
|
||||
|
Reference in New Issue
Block a user