samba-tool: Hide 'samba-tool domain samba3upgrade'.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 25 Sep 2012 20:34:36 +0000 (22:34 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 26 Sep 2012 05:58:31 +0000 (07:58 +0200)
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

source4/scripting/python/samba/netcmd/__init__.py
source4/scripting/python/samba/netcmd/domain.py

index f8ce5abe18f7ec14cef3ad04e3c17780df350393..358167806a8790c08ad431a89f7ef666efbacd98 100644 (file)
@@ -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."""
 
index 4c76f0b7310180aae2d0b0e28fb1023a40621e60..43e92599fee5182e1f1423a6cb6808ecd9ddea57 100644 (file)
@@ -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()