From: Douglas Bagnall Date: Fri, 12 Aug 2022 04:46:03 +0000 (+1200) Subject: samba-tool dns: query uses DnsConnWrapper messages X-Git-Tag: talloc-2.4.0~1168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bee727a559a827c1e15a3b382fd9363c5bf285c0;p=thirdparty%2Fsamba.git samba-tool dns: query uses DnsConnWrapper messages Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py index c7b00ec5e17..e3a26b53a23 100644 --- a/python/samba/netcmd/dns.py +++ b/python/samba/netcmd/dns.py @@ -1073,14 +1073,14 @@ class cmd_query(Command): self.creds = credopts.get_credentials(self.lp) dns_conn = DnsConnWrapper(server, self.lp, self.creds) - try: - buflen, res = dns_conn.DnssrvEnumRecords2( - dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, - None, record_type, select_flags, None, None) - except WERRORError as e: - if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - raise CommandError('Record or zone does not exist.') - raise e + messages = { + werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: ( + 'Record or zone does not exist.') + } + buflen, res = dns_conn.DnssrvEnumRecords2( + dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, + None, record_type, select_flags, None, None, + messages=messages) print_dnsrecords(self.outf, res)