diff --git a/dnssync_perm.py b/dnssync_perm.py index a759220ac1ff56afd73f87017f67df089a7c92fe..c69dab12d80914ee83273ba0b2394c8911f4bbc2 100644 --- a/dnssync_perm.py +++ b/dnssync_perm.py @@ -131,11 +131,13 @@ class NameZoneValidator(CustomValidator): # This check is necessary because of the prefix-DNS view relation of dns_sync if not ipaddress_in_existing_prefix(ipaddress, request): - self.fail(f"IP address '{ipaddress}' is not in any existing prefix", field="address") + self.fail(f"Prefix for '{ipaddress}' not found in VRF '{ipaddress.vrf}'", field="address") if not prefix_has_dns_view(ipaddress, request): - self.fail(f"IP address '{ipaddress}' is in a prefix for which there is no DNS view defined. Ask your NetBox administrator", field="address") + self.fail(f"Prefix for '{ipaddress}' has no DNS view defined. Ask your NetBox administrator", field="address") if not name_has_valid_zone(dns_name, ipaddress, request): - self.fail(f"Name '{dns_name}' is in an non-existing zone name", field="dns_name") + words = dns_name.split(".") + supposed_zone = '.'.join(words[1:]) + self.fail(f"Zone does not exist. Is '{supposed_zone}' correct?", field="dns_name")