1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Route53 provider: pass the right correction message based on action (#151)

This commit is contained in:
Norm MacLennan
2017-07-14 16:03:04 -04:00
committed by Tom Limoncelli
parent 8b3bc9e5e6
commit d1fba2c236

View File

@ -224,14 +224,15 @@ func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
changeReq := &r53.ChangeResourceRecordSetsInput{
ChangeBatch: &r53.ChangeBatch{Changes: changes},
}
delReq := &r53.ChangeResourceRecordSetsInput{
ChangeBatch: &r53.ChangeBatch{Changes: dels},
}
addCorrection := func(req *r53.ChangeResourceRecordSetsInput) {
addCorrection := func(msg string, req *r53.ChangeResourceRecordSetsInput) {
corrections = append(corrections,
&models.Correction{
Msg: changeDesc,
Msg: msg,
F: func() error {
req.HostedZoneId = zone.Id
_, err := r.client.ChangeResourceRecordSets(req)
@ -239,11 +240,13 @@ func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
},
})
}
if len(dels) > 0 {
addCorrection(delReq)
addCorrection(delDesc, delReq)
}
if len(changes) > 0 {
addCorrection(changeReq)
addCorrection(changeDesc, changeReq)
}
return corrections, nil