This repository has been archived by the owner on May 24, 2024. It is now read-only.
Automatic generation of SOA Serial numbers based on the modification dates of zone and records #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #73
This PR implements the strategy outlined in discussion #64.
Every time a zone or a record is changed in NetBox DNS, the "last_updated" field is set to the time of the change. The code submitted updates the SOA SERIAL field for a zone on every change of a record in the zone or the zone itself to an integer number representing the maximum Epoch time stamp of the zone object's and all related records' "last_updated" fields.
Special care needs to be taken in case of the deletion of records, as the operation does not change anything in the zone object, so the serial number would not change. To avoid that issue, the zone's "last_updated" field is set to the current time
every time a record belonging to the zone is deleted.
Changes to SOA records are exempt from calculating the zone's serial number to avoid the risk of endless loops (which is rather low, but still present and since the SOA record will only change when the SOA related fields in the zone change the SOA record is not interesting for the serial calculation.
There is a new setting in the PLUGINS_CONFIG field for netbox_dns:
zone_soa_serial_auto
can be set to a boolean value determining whether new records should have automatic SOA generation enabled or not. The default for new zones is "True".On migration, all existing zones will have the "zone_soa_auto" flag set to "False" to provide backward compatibility and avoid data loss.