mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
dnsserver.py: dnsserver-find no longer returns internal server error
Invocation of the ipa dnsserver-find command failed with internal server error when there is no DNS server in topology. Fixes: https://pagure.io/freeipa/issue/6571 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
440c61dc40
commit
74d36a8af6
@@ -29,6 +29,7 @@ from ipaserver.plugins.baseldap import (
|
||||
LDAPDelete,
|
||||
)
|
||||
from .dns import dns_container_exists
|
||||
from ipapython.dn import DN
|
||||
|
||||
|
||||
__doc__ = _("""
|
||||
@@ -166,6 +167,16 @@ class dnsserver_find(LDAPSearch):
|
||||
'%(count)d DNS servers matched', 0
|
||||
)
|
||||
|
||||
def pre_callback(self, ldap, filters, attrs_list,
|
||||
base_dn, scope, *args, **options):
|
||||
assert isinstance(base_dn, DN)
|
||||
|
||||
if not dns_container_exists(self.api.Backend.ldap2):
|
||||
raise errors.InvocationError(
|
||||
format=_('IPA DNS Server is not installed'))
|
||||
|
||||
return (filters, base_dn, scope)
|
||||
|
||||
|
||||
@register()
|
||||
class dnsserver_show(LDAPRetrieve):
|
||||
|
||||
Reference in New Issue
Block a user