From 49dc04f9f553c443c78c8073c07ea2a38cde61b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= Date: Tue, 18 Dec 2018 12:58:53 +0100 Subject: [PATCH] samba-tool: don't print backtrace on simple DNS errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit samba-tool throws backtraces even for simple DNS error messages, we should not frighten users for no good reason. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13721 Signed-off-by: Bjoern Jacke Reviewed-by: Stefan Metzmacher Autobuild-User(master): Björn Jacke Autobuild-Date(master): Wed Dec 19 20:58:52 CET 2018 on sn-devel-144 --- python/samba/netcmd/dns.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py index b50e7b7dd0c..b7459a71acd 100644 --- a/python/samba/netcmd/dns.py +++ b/python/samba/netcmd/dns.py @@ -780,7 +780,7 @@ class cmd_zonedelete(Command): None) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST: - self.outf.write('Zone does not exist and so could not be deleted.') + raise CommandError('Zone does not exist and so could not be deleted.') raise e self.outf.write('Zone %s deleted successfully\n' % zone) @@ -860,7 +860,7 @@ class cmd_query(Command): None, record_type, select_flags, None, None) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - self.outf.write('Record or zone does not exist.') + raise CommandError('Record or zone does not exist.') raise e print_dnsrecords(self.outf, res) @@ -940,7 +940,7 @@ class cmd_add_record(Command): 0, server, zone, name, add_rec_buf, None) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - self.outf.write('Zone does not exist; record could not be added.\n') + raise CommandError('Zone does not exist; record could not be added.') raise e self.outf.write('Record added successfully\n') @@ -1011,7 +1011,7 @@ class cmd_update_record(Command): del_rec_buf) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - self.outf.write('Zone does not exist; record could not be updated.\n') + raise CommandError('Zone does not exist; record could not be updated.') raise e self.outf.write('Record updated successfully\n') @@ -1066,7 +1066,7 @@ class cmd_delete_record(Command): del_rec_buf) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - self.outf.write('Zone does not exist; record could not be deleted.\n') + raise CommandError('Zone does not exist; record could not be deleted.') raise e self.outf.write('Record deleted successfully\n')