mirror of
https://github.com/samba-team/samba.git
synced 2025-08-05 12:22:11 +03:00
s4-python: added --debuglevel to our python scripts
very useful for debugging our cPython extensions, such as dcerpc modules
This commit is contained in:
@ -22,6 +22,7 @@
|
|||||||
import optparse
|
import optparse
|
||||||
from credentials import Credentials, DONT_USE_KERBEROS, MUST_USE_KERBEROS
|
from credentials import Credentials, DONT_USE_KERBEROS, MUST_USE_KERBEROS
|
||||||
from hostconfig import Hostconfig
|
from hostconfig import Hostconfig
|
||||||
|
import glue
|
||||||
|
|
||||||
__docformat__ = "restructuredText"
|
__docformat__ = "restructuredText"
|
||||||
|
|
||||||
@ -32,7 +33,11 @@ class SambaOptions(optparse.OptionGroup):
|
|||||||
self.add_option("-s", "--configfile", action="callback",
|
self.add_option("-s", "--configfile", action="callback",
|
||||||
type=str, metavar="FILE", help="Configuration file",
|
type=str, metavar="FILE", help="Configuration file",
|
||||||
callback=self._load_configfile)
|
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._configfile = None
|
||||||
|
self._debuglevel = None
|
||||||
|
|
||||||
def get_loadparm_path(self):
|
def get_loadparm_path(self):
|
||||||
"""Return the path to the smb.conf file specified on the command line. """
|
"""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):
|
def _load_configfile(self, option, opt_str, arg, parser):
|
||||||
self._configfile = arg
|
self._configfile = arg
|
||||||
|
|
||||||
|
def _set_debuglevel(self, option, opt_str, arg, parser):
|
||||||
|
self._debuglevel = arg
|
||||||
|
|
||||||
def get_loadparm(self):
|
def get_loadparm(self):
|
||||||
"""Return a loadparm object with data specified on the command line. """
|
"""Return a loadparm object with data specified on the command line. """
|
||||||
import os, param
|
import os, param
|
||||||
@ -51,6 +59,8 @@ class SambaOptions(optparse.OptionGroup):
|
|||||||
lp.load(os.getenv("SMB_CONF_PATH"))
|
lp.load(os.getenv("SMB_CONF_PATH"))
|
||||||
else:
|
else:
|
||||||
lp.load_default()
|
lp.load_default()
|
||||||
|
if self._debuglevel:
|
||||||
|
glue.set_debug_level(self._debuglevel)
|
||||||
return lp
|
return lp
|
||||||
|
|
||||||
def get_hostconfig(self):
|
def get_hostconfig(self):
|
||||||
|
Reference in New Issue
Block a user