python: Allow debug classes to be specified on the command line for python tools
authorAndrew Bartlett <abartlet@samba.org>
Wed, 6 Sep 2017 23:26:04 +0000 (11:26 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Sep 2017 08:43:33 +0000 (10:43 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Sep  7 10:43:33 CEST 2017 on sn-devel-144

python/samba/getopt.py

index 4f1c6020f0660e23473dff963699be582cdbe6e8..b33a5c07ba462d67b245755093222b1a4da368b0 100644 (file)
@@ -40,7 +40,7 @@ class SambaOptions(optparse.OptionGroup):
                         type=str, metavar="FILE", help="Configuration file",
                         callback=self._load_configfile)
         self.add_option("-d", "--debuglevel", action="callback",
-                        type=int, metavar="DEBUGLEVEL", help="debug level",
+                        type=str, metavar="DEBUGLEVEL", help="debug level",
                         callback=self._set_debuglevel)
         self.add_option("--option", action="callback",
                         type=str, metavar="OPTION",
@@ -64,8 +64,8 @@ class SambaOptions(optparse.OptionGroup):
         if arg < 0:
             raise optparse.OptionValueError("invalid %s option value: %s" %
                                             (opt_str, arg))
-        self._lp.set('debug level', str(arg))
-        parser.values.debuglevel = int(arg)
+        self._lp.set('debug level', arg)
+        parser.values.debuglevel = arg
 
     def _set_realm(self, option, opt_str, arg, parser):
         self._lp.set('realm', arg)