diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index ef282c946..48d6f740e 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -2231,7 +2231,11 @@ class DNSZoneBase_disable(LDAPQuery): ldap = self.obj.backend dn = self.obj.get_dn(*keys, **options) - entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass']) + try: + entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass']) + except errors.NotFound: + self.obj.handle_not_found(*keys) + if not _check_entry_objectclass(entry, self.obj.object_class): self.obj.handle_not_found(*keys) @@ -2252,7 +2256,11 @@ class DNSZoneBase_enable(LDAPQuery): ldap = self.obj.backend dn = self.obj.get_dn(*keys, **options) - entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass']) + try: + entry = ldap.get_entry(dn, ['idnszoneactive', 'objectclass']) + except errors.NotFound: + self.obj.handle_not_found(*keys) + if not _check_entry_objectclass(entry, self.obj.object_class): self.obj.handle_not_found(*keys) diff --git a/ipatests/test_xmlrpc/test_dns_plugin.py b/ipatests/test_xmlrpc/test_dns_plugin.py index f0b8edaa1..e5d1374d0 100644 --- a/ipatests/test_xmlrpc/test_dns_plugin.py +++ b/ipatests/test_xmlrpc/test_dns_plugin.py @@ -4319,7 +4319,9 @@ class test_forward_zones(Declarative): dict( desc='Try to disable non-existent forward zone', command=('dnsforwardzone_disable', [nonexistent_fwzone], {}), - expected=errors.NotFound(reason="no such entry") + expected=errors.NotFound( + reason=u'%s: DNS forward zone not found' % nonexistent_fwzone + ) ), @@ -4364,7 +4366,9 @@ class test_forward_zones(Declarative): dict( desc='Try to enable non-existent forward zone', command=('dnsforwardzone_enable', [nonexistent_fwzone], {}), - expected=errors.NotFound(reason="no such entry") + expected=errors.NotFound( + reason=u'%s: DNS forward zone not found' % nonexistent_fwzone + ) ), ]