summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-09-25 22:34:36 +0200
committerJelmer Vernooij <jelmer@samba.org>2012-09-26 07:58:31 +0200
commitc5e83ee9a57d2d6648941e064f7c1156e52419a9 (patch)
tree30d84d8e56a49857cbb1e5b4c57365efd3dc99ac /source4/scripting/python
parent98d117a5424d62804b7cb3d8a9ad35e703fc158a (diff)
downloadsamba-c5e83ee9a57d2d6648941e064f7c1156e52419a9.tar.gz
samba-c5e83ee9a57d2d6648941e064f7c1156e52419a9.tar.bz2
samba-c5e83ee9a57d2d6648941e064f7c1156e52419a9.zip
samba-tool: Hide 'samba-tool domain samba3upgrade'.
This subcommand is provided for backwards compatibility only; new use of it should be discouraged. Its new name is 'samba-tool domain classicupgrade'. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9047
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py13
-rw-r--r--source4/scripting/python/samba/netcmd/domain.py24
2 files changed, 25 insertions, 12 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index f8ce5abe18..358167806a 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -1,5 +1,5 @@
# Unix SMB/CIFS implementation.
-# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2009-2011
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2009-2012
# Copyright (C) Theresa Halloran <theresahalloran@gmail.com> 2011
#
# This program is free software; you can redistribute it and/or modify
@@ -70,6 +70,8 @@ class Command(object):
takes_options = []
takes_optiongroups = {}
+ hidden = False
+
raw_argv = None
raw_args = None
raw_kwargs = None
@@ -199,9 +201,11 @@ class SuperCommand(Command):
subcmds = self.subcommands.keys()
subcmds.sort()
max_length = max([len(c) for c in subcmds])
- for cmd in subcmds:
- self.outf.write(" %*s - %s\n" % (
- -max_length, cmd, self.subcommands[cmd].short_description))
+ for cmd_name in subcmds:
+ cmd = self.subcommands[cmd_name]
+ if not cmd.hidden:
+ self.outf.write(" %*s - %s\n" % (
+ -max_length, cmd_name, cmd.short_description))
if subcommand in [None]:
raise CommandError("You must specify a subcommand")
if subcommand in ['help', '-h', '--help']:
@@ -210,7 +214,6 @@ class SuperCommand(Command):
raise CommandError("No such subcommand '%s'" % subcommand)
-
class CommandError(Exception):
"""An exception class for samba-tool Command errors."""
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 4c76f0b731..43e92599fe 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -2,7 +2,7 @@
#
# Copyright Matthias Dieter Wallnoefer 2009
# Copyright Andrew Kroeger 2009
-# Copyright Jelmer Vernooij 2007-2009
+# Copyright Jelmer Vernooij 2007-2012
# Copyright Giampaolo Lauria 2011
# Copyright Matthieu Patou <mat@matws.net> 2011
# Copyright Andrew Bartlett 2008
@@ -1230,7 +1230,7 @@ class cmd_domain_classicupgrade(Command):
takes_args = ["smbconf"]
- def run(self, smbconf=None, targetdir=None, dbdir=None, testparm=None,
+ def run(self, smbconf=None, targetdir=None, dbdir=None, testparm=None,
quiet=False, verbose=False, use_xattrs=None, sambaopts=None, versionopts=None,
dns_backend=None, use_ntvfs=False):
@@ -1308,22 +1308,32 @@ class cmd_domain_classicupgrade(Command):
for p in paths:
s3conf.set(p, paths[p])
-
+
# load smb.conf parameters
logger.info("Reading smb.conf")
s3conf.load(smbconf)
samba3 = Samba3(smbconf, s3conf)
-
+
logger.info("Provisioning")
- upgrade_from_samba3(samba3, logger, targetdir, session_info=system_session(),
+ upgrade_from_samba3(samba3, logger, targetdir, session_info=system_session(),
useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
+
+class cmd_domain_samba3upgrade(cmd_domain_classicupgrade):
+ __doc__ = cmd_domain_classicupgrade.__doc__
+
+ # This command is present for backwards compatibility only,
+ # and should not be shown.
+
+ hidden = True
+
+
class cmd_domain(SuperCommand):
"""Domain management"""
subcommands = {}
subcommands["demote"] = cmd_domain_demote()
- if type(cmd_domain_export_keytab).__name__ != 'NoneType':
+ if cmd_domain_export_keytab is not None:
subcommands["exportkeytab"] = cmd_domain_export_keytab()
subcommands["info"] = cmd_domain_info()
subcommands["provision"] = cmd_domain_provision()
@@ -1332,4 +1342,4 @@ class cmd_domain(SuperCommand):
subcommands["level"] = cmd_domain_level()
subcommands["passwordsettings"] = cmd_domain_passwordsettings()
subcommands["classicupgrade"] = cmd_domain_classicupgrade()
- subcommands["samba3upgrade"] = cmd_domain_classicupgrade()
+ subcommands["samba3upgrade"] = cmd_domain_samba3upgrade()