summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2022-08-12 16:44:31 +1200
committerDouglas Bagnall <dbagnall@samba.org>2022-09-06 21:12:36 +0000
commit633872c7d25e59c65f0f23c2f8f87535a171bfec (patch)
tree50a28f9c9a17d045d83738e5bd40b1fca0f8a677 /python
parent36241042dd6ef241e9a674c92131f17e317f78f4 (diff)
downloadsamba-633872c7d25e59c65f0f23c2f8f87535a171bfec.tar.gz
samba-633872c7d25e59c65f0f23c2f8f87535a171bfec.tar.bz2
samba-633872c7d25e59c65f0f23c2f8f87535a171bfec.zip
samba-tool dns: zonedelete uses DnsConnWrapper messages
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/dns.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py
index 10374ade45e..c7b00ec5e17 100644
--- a/python/samba/netcmd/dns.py
+++ b/python/samba/netcmd/dns.py
@@ -991,15 +991,15 @@ class cmd_zonedelete(Command):
dns_conn = DnsConnWrapper(server, self.lp, self.creds)
zone = zone.lower()
- try:
- res = dns_conn.DnssrvOperation2(dnsserver.DNS_CLIENT_VERSION_LONGHORN,
- 0, server, zone, 0, 'DeleteZoneFromDs',
- dnsserver.DNSSRV_TYPEID_NULL,
- None)
- except WERRORError as e:
- if e.args[0] == werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST:
- raise CommandError('Zone does not exist and so could not be deleted.')
- raise e
+
+ messages = {
+ werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST: (
+ f'Zone {zone} does not exist and so could not be deleted.'),
+ }
+ res = dns_conn.DnssrvOperation2(dnsserver.DNS_CLIENT_VERSION_LONGHORN,
+ 0, server, zone, 0, 'DeleteZoneFromDs',
+ dnsserver.DNSSRV_TYPEID_NULL,
+ None, messages=messages)
self.outf.write('Zone %s deleted successfully\n' % zone)