mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Improve dnszone-add error message
When a new DNS record is being added to DNS zone via command ipa dnsrecord-add ZONE @ and the target ZONE does not exist it returns ObjectclassViolation which may confuse users. Make sure that standard DNS Zone NotFound exception is returned. https://fedorahosted.org/freeipa/ticket/2270
This commit is contained in:
parent
f411ed1e47
commit
de9a0df508
@ -1495,6 +1495,13 @@ class dnsrecord(LDAPObject):
|
||||
|
||||
def get_dn(self, *keys, **options):
|
||||
if self.is_pkey_zone_record(*keys):
|
||||
dn = self.api.Object[self.parent_object].get_dn(*keys[:-1], **options)
|
||||
# zone must exist
|
||||
ldap = self.api.Backend.ldap2
|
||||
try:
|
||||
(dn_, zone) = ldap.get_entry(dn, [])
|
||||
except errors.NotFound:
|
||||
self.api.Object['dnszone'].handle_not_found(keys[-2])
|
||||
return self.api.Object[self.parent_object].get_dn(*keys[:-1], **options)
|
||||
return super(dnsrecord, self).get_dn(*keys, **options)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user