]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool domain show: use level_to_string()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 31 Aug 2022 01:28:50 +0000 (13:28 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain.py

index ef3d7c5a357000c8f862048cc57a7dfd2d8553db..9557d7551bfdcee8411279b53f5f6b85e3c4f978 100644 (file)
@@ -1151,58 +1151,16 @@ class cmd_domain_level(Command):
 
             self.message("")
 
-            if level_forest == DS_DOMAIN_FUNCTION_2000:
-                outstr = "2000"
-            elif level_forest == DS_DOMAIN_FUNCTION_2003_MIXED:
-                outstr = "2003 with mixed domains/interim (NT4 DC support)"
-            elif level_forest == DS_DOMAIN_FUNCTION_2003:
-                outstr = "2003"
-            elif level_forest == DS_DOMAIN_FUNCTION_2008:
-                outstr = "2008"
-            elif level_forest == DS_DOMAIN_FUNCTION_2008_R2:
-                outstr = "2008 R2"
-            elif level_forest == DS_DOMAIN_FUNCTION_2012:
-                outstr = "2012"
-            elif level_forest == DS_DOMAIN_FUNCTION_2012_R2:
-                outstr = "2012 R2"
-            else:
-                outstr = "higher than 2012 R2"
+            outstr = level_to_string(level_forest)
             self.message("Forest function level: (Windows) " + outstr)
 
-            if level_domain == DS_DOMAIN_FUNCTION_2000 and level_domain_mixed != 0:
+            if level_domain == DS_DOMAIN_FUNCTION_2000 and level_domain_mixed:
                 outstr = "2000 mixed (NT4 DC support)"
-            elif level_domain == DS_DOMAIN_FUNCTION_2000 and level_domain_mixed == 0:
-                outstr = "2000"
-            elif level_domain == DS_DOMAIN_FUNCTION_2003_MIXED:
-                outstr = "2003 with mixed domains/interim (NT4 DC support)"
-            elif level_domain == DS_DOMAIN_FUNCTION_2003:
-                outstr = "2003"
-            elif level_domain == DS_DOMAIN_FUNCTION_2008:
-                outstr = "2008"
-            elif level_domain == DS_DOMAIN_FUNCTION_2008_R2:
-                outstr = "2008 R2"
-            elif level_domain == DS_DOMAIN_FUNCTION_2012:
-                outstr = "2012"
-            elif level_domain == DS_DOMAIN_FUNCTION_2012_R2:
-                outstr = "2012 R2"
             else:
-                outstr = "higher than 2012 R2"
+                outstr = level_to_string(level_domain)
             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"
-            elif min_level_dc == DS_DOMAIN_FUNCTION_2012:
-                outstr = "2012"
-            elif min_level_dc == DS_DOMAIN_FUNCTION_2012_R2:
-                outstr = "2012 R2"
-            else:
-                outstr = "higher than 2012 R2"
+            outstr = level_to_string(min_level_dc)
             self.message("Lowest function level of a DC: (Windows) " + outstr)
 
         elif subcommand == "raise":