From: Douglas Bagnall Date: Wed, 7 Sep 2022 20:56:45 +0000 (+1200) Subject: samba-tool: command that has exception, shows exception X-Git-Tag: talloc-2.4.0~1125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=153ad8fc3a90446fe25108a8ba4f41812e9b2462;p=thirdparty%2Fsamba.git samba-tool: command that has exception, shows exception This will make a difference to the string printed in the cases that call self.usage(), resulting in more specified usage for the sub-command. It would also matter if the samba-tool sub-command had a different .show_command_error() or .errf, but I don't think that happens. Note: usually command._run() will have caught and shown the exception, returning -1. We also rename away 'cmd' so we don't again imagine it is the command we are running. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/scripting/bin/samba-tool b/source4/scripting/bin/samba-tool index b5f784beff7..c4e672e3798 100755 --- a/source4/scripting/bin/samba-tool +++ b/source4/scripting/bin/samba-tool @@ -31,14 +31,14 @@ import signal signal.signal(signal.SIGINT, signal.SIG_DFL) from samba.netcmd.main import cmd_sambatool -cmd = cmd_sambatool() +samba_tool = cmd_sambatool() try: - command, args = cmd._resolve("samba-tool", *sys.argv[1:]) + command, args = samba_tool._resolve("samba-tool", *sys.argv[1:]) retval = command._run(*args) except SystemExit as e: retval = e.code except Exception as e: - cmd.show_command_error(e) + command.show_command_error(e) retval = 1 sys.exit(retval)