]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool dns: query uses DnsConnWrapper messages
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 12 Aug 2022 04:46:03 +0000 (16:46 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/dns.py

index c7b00ec5e177300af7bcf36aa7743117bcc3cdda..e3a26b53a2387c066474e53b18480fc31c1aa448 100644 (file)
@@ -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)