samba.getopt: Allow --kerberos=auto, and fix exception name if an unknown
authorJelmer Vernooij <jelmer@samba.org>
Tue, 11 Oct 2011 21:56:15 +0000 (23:56 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 12 Oct 2011 00:12:21 +0000 (02:12 +0200)
value is specified.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Wed Oct 12 02:12:21 CEST 2011 on sn-devel-104

source4/scripting/python/samba/getopt.py

index 01e9f87e7654b99fb6b0547c4c3aed599626da7d..1b30d2fade6d459e2ddc642bc798ef11ca52b69e 100644 (file)
@@ -25,6 +25,7 @@ import optparse
 import os
 from samba.credentials import (
     Credentials,
+    AUTO_USE_KERBEROS,
     DONT_USE_KERBEROS,
     MUST_USE_KERBEROS,
     )
@@ -150,8 +151,10 @@ class CredentialsOptions(optparse.OptionGroup):
             self.creds.set_kerberos_state(MUST_USE_KERBEROS)
         elif arg.lower() in ["no", 'false', '0']:
             self.creds.set_kerberos_state(DONT_USE_KERBEROS)
+        elif arg.lower() in ["auto"]:
+            self.creds.set_kerberos_state(AUTO_USE_KERBEROS)
         else:
-            raise optparse.BadOptionErr("invalid kerberos option: %s" % arg)
+            raise optparse.BadOptionError("invalid kerberos option: %s" % arg)
 
     def _set_simple_bind_dn(self, option, opt_str, arg, parser):
         self.creds.set_bind_dn(arg)