summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-02 18:31:30 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-02 18:52:29 +1100
commit23f2db7ab60be499327ae40d7e4c604ded910bea (patch)
tree7e9934077dbfcbddbdd94bdc1d06b1d392f10c61 /source4/scripting
parent2c097b51cb62a0b3cc159faea62d831d897f6017 (diff)
downloadsamba-23f2db7ab60be499327ae40d7e4c604ded910bea.tar.gz
samba-23f2db7ab60be499327ae40d7e4c604ded910bea.tar.bz2
samba-23f2db7ab60be499327ae40d7e4c604ded910bea.zip
s4-python: added --debuglevel to our python scripts
very useful for debugging our cPython extensions, such as dcerpc modules
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/getopt.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index ba7a9ebb2e..62e16f7c75 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -22,6 +22,7 @@
import optparse
from credentials import Credentials, DONT_USE_KERBEROS, MUST_USE_KERBEROS
from hostconfig import Hostconfig
+import glue
__docformat__ = "restructuredText"
@@ -32,7 +33,11 @@ class SambaOptions(optparse.OptionGroup):
self.add_option("-s", "--configfile", action="callback",
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",
+ callback=self._set_debuglevel)
self._configfile = None
+ self._debuglevel = None
def get_loadparm_path(self):
"""Return the path to the smb.conf file specified on the command line. """
@@ -41,6 +46,9 @@ class SambaOptions(optparse.OptionGroup):
def _load_configfile(self, option, opt_str, arg, parser):
self._configfile = arg
+ def _set_debuglevel(self, option, opt_str, arg, parser):
+ self._debuglevel = arg
+
def get_loadparm(self):
"""Return a loadparm object with data specified on the command line. """
import os, param
@@ -51,6 +59,8 @@ class SambaOptions(optparse.OptionGroup):
lp.load(os.getenv("SMB_CONF_PATH"))
else:
lp.load_default()
+ if self._debuglevel:
+ glue.set_debug_level(self._debuglevel)
return lp
def get_hostconfig(self):