mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
NEW FEATURE: NO_PURGE reports what is not purged (diff2 only) (#2031)
This commit is contained in:
@@ -340,6 +340,9 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
|
||||
for _, inst := range instructions {
|
||||
switch inst.Type {
|
||||
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: inst.MsgsJoined})
|
||||
|
||||
case diff2.CHANGE, diff2.CREATE:
|
||||
var rrset *adns.RecordSet
|
||||
var recordName string
|
||||
@@ -390,6 +393,10 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled inst.Type %s", inst.Type))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -361,6 +361,9 @@ func (client *gandiv5Provider) GenerateDomainCorrections(dc *models.DomainConfig
|
||||
for _, inst := range instructions {
|
||||
switch inst.Type {
|
||||
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: inst.MsgsJoined})
|
||||
|
||||
case diff2.CREATE:
|
||||
// We have to create the label one rtype at a time.
|
||||
natives := recordsToNative(inst.New, dc.Name)
|
||||
@@ -420,6 +423,9 @@ func (client *gandiv5Provider) GenerateDomainCorrections(dc *models.DomainConfig
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled inst.Type %s", inst.Type))
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -158,6 +158,7 @@ func (c *gcoreProvider) GenerateDomainCorrections(dc *models.DomainConfig, exist
|
||||
// Make delete happen earlier than creates & updates.
|
||||
var corrections []*models.Correction
|
||||
var deletions []*models.Correction
|
||||
var reports []*models.Correction
|
||||
|
||||
if !diff2.EnableDiff2 {
|
||||
|
||||
@@ -246,6 +247,8 @@ func (c *gcoreProvider) GenerateDomainCorrections(dc *models.DomainConfig, exist
|
||||
msg := generateChangeMsg(change.Msgs)
|
||||
|
||||
switch change.Type {
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: change.MsgsJoined})
|
||||
case diff2.CREATE:
|
||||
corrections = append(corrections, &models.Correction{
|
||||
Msg: msg,
|
||||
@@ -267,9 +270,13 @@ func (c *gcoreProvider) GenerateDomainCorrections(dc *models.DomainConfig, exist
|
||||
return c.provider.DeleteRRSet(c.ctx, zone, name, typ)
|
||||
},
|
||||
})
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled change.Type %s", change.Type))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return append(deletions, corrections...), nil
|
||||
result := append(reports, deletions...)
|
||||
result = append(result, corrections...)
|
||||
return result, nil
|
||||
}
|
||||
|
@@ -259,6 +259,8 @@ func (c *hednsProvider) getDiff2DomainCorrections(dc *models.DomainConfig, zoneI
|
||||
var corrections []*models.Correction
|
||||
for _, change := range changes {
|
||||
switch change.Type {
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: change.MsgsJoined})
|
||||
case diff2.CREATE:
|
||||
record := change.New[0]
|
||||
corrections = append(corrections, &models.Correction{
|
||||
@@ -284,6 +286,8 @@ func (c *hednsProvider) getDiff2DomainCorrections(dc *models.DomainConfig, zoneI
|
||||
return c.deleteZoneRecord(zoneID, recordID)
|
||||
},
|
||||
})
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled change.Type %s", change.Type))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -212,25 +212,28 @@ func (n *nsone) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correct
|
||||
recs := change.New
|
||||
desc := strings.Join(change.Msgs, "\n")
|
||||
|
||||
if change.Type == diff2.CREATE {
|
||||
switch change.Type {
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: change.MsgsJoined})
|
||||
case diff2.CREATE:
|
||||
corrections = append(corrections, &models.Correction{
|
||||
Msg: desc,
|
||||
F: func() error { return n.add(recs, dc.Name) },
|
||||
})
|
||||
}
|
||||
if change.Type == diff2.CHANGE {
|
||||
case diff2.CHANGE:
|
||||
corrections = append(corrections, &models.Correction{
|
||||
Msg: desc,
|
||||
F: func() error { return n.modify(recs, dc.Name) },
|
||||
})
|
||||
|
||||
}
|
||||
if change.Type == diff2.DELETE {
|
||||
case diff2.DELETE:
|
||||
corrections = append(corrections, &models.Correction{
|
||||
Msg: desc,
|
||||
F: func() error { return n.remove(key, dc.Name) },
|
||||
})
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled inst.Type %s", change.Type))
|
||||
}
|
||||
|
||||
}
|
||||
return corrections, nil
|
||||
}
|
||||
|
@@ -201,6 +201,8 @@ func (c *ovhProvider) getDiff2DomainCorrections(dc *models.DomainConfig, actual
|
||||
|
||||
for _, inst := range instructions {
|
||||
switch inst.Type {
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: inst.MsgsJoined})
|
||||
case diff2.CHANGE:
|
||||
corrections = append(corrections, &models.Correction{
|
||||
Msg: inst.Msgs[0],
|
||||
@@ -217,6 +219,8 @@ func (c *ovhProvider) getDiff2DomainCorrections(dc *models.DomainConfig, actual
|
||||
Msg: inst.Msgs[0],
|
||||
F: c.deleteRecordFunc(rec.ID, dc.Name),
|
||||
})
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled inst.Type %s", inst.Type))
|
||||
}
|
||||
}
|
||||
return corrections, nil
|
||||
|
@@ -161,6 +161,8 @@ func (c *porkbunProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
for _, change := range changes {
|
||||
var corr *models.Correction
|
||||
switch change.Type {
|
||||
case diff2.REPORT:
|
||||
corr = &models.Correction{Msg: change.MsgsJoined}
|
||||
case diff2.CREATE:
|
||||
req, err := toReq(change.New[0])
|
||||
if err != nil {
|
||||
@@ -192,6 +194,8 @@ func (c *porkbunProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
return c.deleteRecord(dc.Name, id)
|
||||
},
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled change.Type %s", change.Type))
|
||||
}
|
||||
corrections = append(corrections, corr)
|
||||
}
|
||||
|
@@ -488,6 +488,9 @@ func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
|
||||
switch inst.Type {
|
||||
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: inst.MsgsJoined})
|
||||
|
||||
case diff2.CREATE:
|
||||
fallthrough
|
||||
case diff2.CHANGE:
|
||||
@@ -529,6 +532,10 @@ func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
Action: r53Types.ChangeActionDelete,
|
||||
ResourceRecordSet: &rrset,
|
||||
}
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled inst.Type %s", inst.Type))
|
||||
|
||||
}
|
||||
|
||||
changes = append(changes, chg)
|
||||
|
@@ -183,6 +183,8 @@ func (api *vultrProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
|
||||
for _, change := range changes {
|
||||
switch change.Type {
|
||||
case diff2.REPORT:
|
||||
corrections = append(corrections, &models.Correction{Msg: change.MsgsJoined})
|
||||
case diff2.CREATE:
|
||||
r := toVultrRecord(dc, change.New[0], "0")
|
||||
corrections = append(corrections, &models.Correction{
|
||||
@@ -208,6 +210,8 @@ func (api *vultrProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
||||
return api.client.DomainRecord.Delete(context.Background(), dc.Name, id)
|
||||
},
|
||||
})
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled change.Type %s", change.Type))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user