summaryrefslogtreecommitdiff
path: root/source4/scripting/bin/samba-tool
AgeCommit message (Collapse)AuthorFilesLines
2022-09-08samba-tool: binary uses samba_tool functionDouglas Bagnall1-10/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-09-08samba-tool: command that has exception, shows exceptionDouglas Bagnall1-3/+3
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 <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-09-08samba-tool: separate ._run() from command resolutionDouglas Bagnall1-8/+2
Prior to this commit, in super-commands, the first half of the _run() is resolving what sub-command to run, and the second half is working out what to print if that failed. Some issues with that are: * it looks a little bit complicated. * the tests can't use the tool's resolution code, because it runs immediately, while the tests first want to fiddle with self.outf and so on. * it makes it harder to subclass and override the resolution code, so instead we do strange things like where we subclass dict as in main.py. So we split it into ._resolve() and ._run(). There are a few tests that break. We mark these as flapping, rather than knownfail, so as to avoid going into extremely fine-grain filters for tests that will be fixed within a few commits. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-14PY3: change shebang to python3 in source4/scripting/bin dirJoe Guo1-1/+1
Samba default python is 3 now. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2018-02-15source4/scripting python: convert 'except X, e' to 'except X as e'Douglas Bagnall1-2/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-09-25s4-python: Override SIGINT handler in scripts only.Jelmer Vernooij1-0/+7
Override the SIGINT handler in a few select cases only, rather than doing so in one of the samba Python modules. I've done this where it matters most; we can add this code to other scripts too if necessary. This means that importing the 'samba' module from a third party application does not have side-effects on the state of the signal handlers. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9068
2012-09-11s4:samba-tool: allow sys.exit(ret) to control the exit codeStefan Metzmacher1-1/+1
Some subcommands may use sys.exit(0), which shouldn't be reported as an error to the caller. metze
2011-10-14samba-tool: Move main command implementation to samba.netcmd.main, so it is ↵Jelmer Vernooij1-60/+18
accessible by the testsuite.
2011-10-13netcmd: Add errf stream to command instances.Jelmer Vernooij1-1/+2
2011-09-13s4-python: Consistently use spaces rather than tabs, fix headers in several ↵Jelmer Vernooij1-1/+1
places.
2011-09-09samba-tool: Correctly handle sys.exit() called from subcommandAmitay Isaacs1-1/+3
Catch SystemExit exception if any subcommand calls sys.exit() and return with failure (-1). Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-09samba-tool: Removed "acl" commandGiampaolo Lauria1-2/+0
Removed "acl" command as it has been changed to: "dsacl" and "ntacl" Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-09samba-tool: Added "ntacl" commandGiampaolo Lauria1-0/+2
Added "ntacl" command to substitute "acl nt" command Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-09samba-tool: Added "dsacl" commandGiampaolo Lauria1-0/+2
Added "dsacl" command to substitute "acl ds" Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-09samba-tool: Moved command definition to sambatool commandGiampaolo Lauria1-8/+36
Moved subcommand definition from __init__.py to cmd_sambatool class Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-09samba-tool: Redefined samba-tool as a SuperCommandGiampaolo Lauria1-31/+5
Removed MainCommand class as samba-tool is a SuperCommand Redefined samba-tool as a SuperCommand Fixed error handling in SuperCommand _run Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-09-08samba-tool: Avoid use of "except .. as" construction introduced in python2.6.Jelmer Vernooij1-2/+3
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Thu Sep 8 00:34:22 CEST 2011 on sn-devel-104
2011-07-28samba-tool: Catch exceptions at top-level and exit with correct return valueAmitay Isaacs1-1/+5
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-28samba-tool: Display usage for main commands and list them alphabeticallyAmitay Isaacs1-31/+35
This makes the MainCommand class similar to SuperCommand class in netcmd. Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-28samba-tool: Replace C version of samba-tool with python versionAmitay Isaacs1-0/+69
C version of samba-tool is now called samba-tool-c, which will be removed as soon as all the samba-tool commands are ported to python. Signed-off-by: Andrew Tridgell <tridge@samba.org>