Check whether dns_name set before running post_clean on IP addresses #489
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 #488
This PR fixes an issue with the validation of DNS names for IP addresses with DNSsync.
When bulk-importing a duplicate IP address that would violate a uniqueness constraint (either set per prefix or via
ENFORCE_GLOBAL_UNIQUE
), thepost_clean
handler for NetBox DNS is apparently run before the duplicate check in NetBox is executed. This causes NetBox DNS to check for duplicate address records, and even if the DNS name is empty for the duplicate records this will result in an error message stating that there are duplicate records for the IP address.This is OK if DNS names have actually been set and are the same, but if there are none the error message is erroneous and should not be raised as it covers the real reason for the failed import.