1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-16 00:23:52 +03:00

samba-tool: all subcommands know --version

Before `samba-tool -V` would give you the version,
but `samba-tool spn -V` would complain.

An ad-hoc selection of sub-commands already supported --version,
depending on whether VersionOptions was manually added to the
takes_options dict. The .run() methods of these subcommands all take a
'versionopts' keyword argument, but never use it. If it was set (i.e.,
argv contained "--version"), the process never gets to .run(), so the
value of versionopts.version is always None in run(). After this
commit we can remove VersionOptions/versionopts from sub-commands.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
This commit is contained in:
Douglas Bagnall
2025-01-15 15:33:18 +13:00
committed by Douglas Bagnall
parent 3a408f06ae
commit 8aec198306
3 changed files with 33 additions and 9 deletions

View File

@@ -17,7 +17,6 @@
"""The main samba-tool command implementation."""
from samba import getopt as options
from samba.netcmd import SuperCommand
@@ -52,10 +51,6 @@ class cache_loader(dict):
class cmd_sambatool(SuperCommand):
"""Main samba administration tool."""
takes_optiongroups = {
"versionopts": options.VersionOptions,
}
subcommands = cache_loader()
subcommands["computer"] = None