From 0363879d1fc1c76ec717467e98f2f15f5e902b09 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 31 Aug 2022 13:28:50 +1200 Subject: [PATCH] samba-tool domain show: use level_to_string() Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- python/samba/netcmd/domain.py | 50 +++-------------------------------- 1 file changed, 4 insertions(+), 46 deletions(-) diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index ef3d7c5a357..9557d7551bf 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -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": -- 2.47.3