mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-10-10 22:06:10 +08:00
bind puts output inside correction text
This commit is contained in:
parent
36c7911926
commit
004d817349
1 changed files with 8 additions and 5 deletions
|
@ -18,6 +18,7 @@ bind -
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -200,30 +201,32 @@ func (c *Bind) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correcti
|
||||||
differ := diff.New(dc)
|
differ := diff.New(dc)
|
||||||
_, create, del, mod := differ.IncrementalDiff(foundRecords)
|
_, create, del, mod := differ.IncrementalDiff(foundRecords)
|
||||||
|
|
||||||
|
buf := &bytes.Buffer{}
|
||||||
// Print a list of changes. Generate an actual change that is the zone
|
// Print a list of changes. Generate an actual change that is the zone
|
||||||
changes := false
|
changes := false
|
||||||
for _, i := range create {
|
for _, i := range create {
|
||||||
changes = true
|
changes = true
|
||||||
if zone_file_found {
|
if zone_file_found {
|
||||||
fmt.Println(i)
|
fmt.Fprintln(buf, i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, i := range del {
|
for _, i := range del {
|
||||||
changes = true
|
changes = true
|
||||||
if zone_file_found {
|
if zone_file_found {
|
||||||
fmt.Println(i)
|
fmt.Fprintln(buf, i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, i := range mod {
|
for _, i := range mod {
|
||||||
changes = true
|
changes = true
|
||||||
if zone_file_found {
|
if zone_file_found {
|
||||||
fmt.Println(i)
|
fmt.Fprintln(buf, i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("GENERATE_ZONEFILE: %s", dc.Name)
|
msg := fmt.Sprintf("GENERATE_ZONEFILE: %s\n", dc.Name)
|
||||||
if !zone_file_found {
|
if !zone_file_found {
|
||||||
msg = msg + fmt.Sprintf(" (%d records)", len(create))
|
msg = msg + fmt.Sprintf(" (%d records)\n", len(create))
|
||||||
}
|
}
|
||||||
|
msg += buf.String()
|
||||||
corrections := []*models.Correction{}
|
corrections := []*models.Correction{}
|
||||||
if changes {
|
if changes {
|
||||||
corrections = append(corrections,
|
corrections = append(corrections,
|
||||||
|
|
Loading…
Add table
Reference in a new issue