From 7e460a04f79c9056b7b0b6c927caa2db96229633 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 9 Sep 2011 15:27:25 +0200 Subject: s4:samba-tool/domain.py - restore domain raise functionality The samba-tool command has accidentally been damaged by commit 2d4988c3d79e501003875cd26b7f9aaa72402b31. Reviewed-by: Jelmer --- source4/scripting/python/samba/netcmd/domain.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 884ea64b9f..20beea0fb5 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -131,6 +131,8 @@ class cmd_domain_level(Command): Option("--quiet", help="Be quiet", action="store_true"), Option("--forest", type="choice", choices=["2003", "2008", "2008_R2"], help="The forest function level (2003 | 2008 | 2008_R2)"), + Option("--domain", type="choice", choices=["2003", "2008", "2008_R2"], + help="The domain function level (2003 | 2008 | 2008_R2)") ] takes_args = ["subcommand"] @@ -219,6 +221,18 @@ class cmd_domain_level(Command): outstr = "2008 R2" else: outstr = "higher than 2008 R2" + self.message("Domain function level: (Windows) " + outstr) + + if min_level_dc == DS_DOMAIN_FUNCTION_2000: + outstr = "2000" + elif min_level_dc == DS_DOMAIN_FUNCTION_2003: + outstr = "2003" + elif min_level_dc == DS_DOMAIN_FUNCTION_2008: + outstr = "2008" + elif min_level_dc == DS_DOMAIN_FUNCTION_2008_R2: + outstr = "2008 R2" + else: + outstr = "higher than 2008 R2" self.message("Lowest function level of a DC: (Windows) " + outstr) elif subcommand == "raise": @@ -261,7 +275,8 @@ class cmd_domain_level(Command): # Directly on the base DN m = ldb.Message() m.dn = ldb.Dn(samdb, domain_dn) - m["msDS-Behavior-Version"]= ldb.MessageElement( str(new_level_domain), ldb.FLAG_MOD_REPLACE, + m["msDS-Behavior-Version"]= ldb.MessageElement( + str(new_level_domain), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") samdb.modify(m) # Under partitions -- cgit