samba-tool: let 'domain functionalprep' to use functional level 2016 by default
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Feb 2023 14:05:01 +0000 (15:05 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 22 Mar 2023 22:10:32 +0000 (22:10 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain.py
testprogs/blackbox/functionalprep.sh

index c1611d77afdffa7051c7d93a06ab33ab1dd560e6..4f9d58d7952d0b7086c57f3b72925232335de646 100644 (file)
@@ -4397,9 +4397,9 @@ class cmd_domain_functional_prep(Command):
         Option("-q", "--quiet", help="Be quiet", action="store_true"),
         Option("-v", "--verbose", help="Be verbose", action="store_true"),
         Option("--function-level", type="choice", metavar="FUNCTION_LEVEL",
-               choices=["2008_R2", "2012", "2012_R2"],
-               help="The schema file to upgrade to. Default is (Windows) 2012_R2.",
-               default="2012_R2"),
+               choices=["2008_R2", "2012", "2012_R2", "2016"],
+               help="The functional level to prepare for. Default is (Windows) 2016.",
+               default="2016"),
         Option("--forest-prep", action="store_true",
                help="Run the forest prep (by default, both the domain and forest prep are run)."),
         Option("--domain-prep", action="store_true",
index e3cec4c2638a1a615245e847b429b13f21904e0a..3ddd31456f07d6dc2bf674e7c6c101d3f969d76c 100755 (executable)
@@ -47,6 +47,7 @@ fi
 cleanup_output_directories()
 {
        remove_directory $PREFIX_ABS/2012R2_schema
+       remove_directory $PREFIX_ABS/2019_schema
        remove_directory $PREFIX_ABS/$RELEASE
        remove_directory $PREFIX_ABS/$OLD_RELEASE
 }
@@ -63,6 +64,11 @@ undump_old()
 
 PROVISION_OPTS="--use-ntvfs --host-ip6=::1 --host-ip=127.0.0.1"
 
+provision_2019()
+{
+       $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=REALM --realm=REALM.COM --targetdir=$PREFIX_ABS/2019_schema --base-schema=2019 --host-name=FLPREP
+}
+
 provision_2012r2()
 {
        $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=REALM --realm=REALM.COM --targetdir=$PREFIX_ABS/2012R2_schema --base-schema=2012_R2 --host-name=FLPREP
@@ -82,7 +88,12 @@ ldapcmp()
        ldapcmp_ignore "msDS-ClaimPossibleValues" "$RELEASE" "2012R2_schema"
 }
 
-functional_prep()
+functional_prep_2016()
+{
+       $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/2019_schema/private/sam.ldb --function-level=2016
+}
+
+functional_prep_2012R2()
 {
        $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/2012R2_schema/private/sam.ldb --function-level=2012_R2
 }
@@ -113,7 +124,7 @@ testit $RELEASE undump || failed=$(expr $failed + 1)
 testit "provision_2012R2_schema" provision_2012r2 || failed=$(expr $failed + 1)
 
 # Perform functional prep up to 2012 R2 level
-testit "functional_prep" functional_prep || failed=$(expr $failed + 1)
+testit "functional_prep_2012R2" functional_prep_2012R2 || failed=$(expr $failed + 1)
 
 # check that the databases are now the same
 testit "check_databases_same" ldapcmp || failed=$(expr $failed + 1)
@@ -128,4 +139,12 @@ testit "functional_prep_old" functional_prep_old || failed=$(expr $failed + 1)
 
 cleanup_output_directories
 
+# Provision a DC based on 2019 schema
+testit "provision_2019_schema" provision_2019 || failed=$(expr $failed + 1)
+
+# Perform functional prep up to 2016 level
+testit "functional_prep_2016" functional_prep_2016 || failed=$(expr $failed + 1)
+
+cleanup_output_directories
+
 exit $failed