samba-tool: do not force a traceback on CommandError
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 1 Sep 2022 01:16:53 +0000 (01:16 +0000)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
When a CommandError has an 'inner exception', we have been printing
drowning out the error message with a long traceback of the exception
we tried to catch.

People who really want to see tracebacks can use -d3.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 0cb2ee43765f1b8bde460668654a11f269a5a78a..73292489268c220344257f037906f7bedfc77778 100644 (file)
@@ -137,7 +137,6 @@ class Command(object):
             self.errf.write("ERROR: %s\n" % (message))
         else:
             self.errf.write("ERROR(%s): %s - %s\n" % (str(etype), message, evalue))
-            force_traceback = True
 
         if force_traceback or samba.get_debug_level() >= 3:
             traceback.print_tb(etraceback, file=self.errf)