Disable records instead of deleting them
A disabled record stays in Jarl with its ID, TTL and comment but is left out of the zone; the zone file lists it as a comment. Web UI toggle, jarl record disable|enable, record.disable|enable operations and API endpoints. Database schema 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f04ab523b
commit
295c549479
29 files changed
+815
-60
No files matched your search
@@ -103,6 +103,31 @@ func (c *checker) zoneLimit(z *model.Zone, name string, def int) int {
|
||||
return n
|
||||
}
|
||||
|
||||
// checkDisabledRecords warns about disabled records that couldn't be
|
||||
// enabled again as the zone is now: the CNAME rules are the usual way a
|
||||
// name changes while one of its records is disabled.
|
||||
func (c *checker) checkDisabledRecords(z *model.Zone) {
|
||||
served := map[string]map[string]bool{}
|
||||
for _, r := range c.zoneRecords[z.ID] {
|
||||
if served[r.Name] == nil {
|
||||
served[r.Name] = map[string]bool{}
|
||||
}
|
||||
served[r.Name][r.Type] = true
|
||||
}
|
||||
for _, r := range c.allRecords[z.ID] {
|
||||
if !r.Disabled {
|
||||
continue
|
||||
}
|
||||
types := served[r.Name]
|
||||
switch {
|
||||
case r.Type != "CNAME" && types["CNAME"]:
|
||||
c.recProblem(z, r, Warning, "disabled_conflict", "the disabled record %s %s %s can't be enabled again while %s has a CNAME (a CNAME must be the only record at its name)", disp(r.Name), r.Type, r.Data, disp(r.Name))
|
||||
case r.Type == "CNAME" && len(types) > 0:
|
||||
c.recProblem(z, r, Warning, "disabled_conflict", "the disabled CNAME %s → %s can't be enabled again while %s has other records (a CNAME must be the only record at its name)", disp(r.Name), r.Data, disp(r.Name))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *checker) checkZoneRecords(z *model.Zone) {
|
||||
ix := &zoneIndex{
|
||||
z: z,
|
||||
|
||||
Reference in new issue
Block a user