netcmd/ldapcmp: add choices arg to --scope option
authorJoe Guo <joeg@catalyst.net.nz>
Sun, 28 Oct 2018 22:54:57 +0000 (11:54 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 21 Nov 2018 06:46:18 +0000 (07:46 +0100)
So we don't need to validate ourselves.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/ldapcmp.py

index 59991a6c956bc2a2baf8bb23b8e2a2f6fc523c41..01739f90f85d1f083673898f02789e404aeeaad9 100644 (file)
@@ -911,7 +911,7 @@ class cmd_ldapcmp(Command):
                help="Pass search base that will build DN list for the first DC."),
         Option("--base2", dest="base2", default="",
                help="Pass search base that will build DN list for the second DC. Used when --two or when compare two different DNs."),
-        Option("--scope", dest="scope", default="SUB",
+        Option("--scope", dest="scope", default="SUB", choices=["SUB", "ONE", "BASE"],
                help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
         Option("--filter", dest="filter", default="",
                help="List of comma separated attributes to ignore in the comparision"),
@@ -966,8 +966,6 @@ class cmd_ldapcmp(Command):
             raise CommandError("You need to specify both --base and --base2 at the same time")
         if descriptor and view.upper() not in ["SECTION", "COLLISION"]:
             raise CommandError("Invalid --view value. Choose from: section or collision")
-        if not scope.upper() in ["SUB", "ONE", "BASE"]:
-            raise CommandError("Invalid --scope value. Choose from: SUB, ONE, BASE")
 
         con1 = LDAPBase(URL1, creds, lp,
                         two=two, quiet=quiet, descriptor=descriptor, sort_aces=sort_aces,