mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
netcmd: apply the new get_logger to cmds
This is an example of how to use the new logger. 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>
This commit is contained in:
parent
0979d96006
commit
126a14b443
@ -1104,13 +1104,7 @@ class cmd_cleanup_record(Command):
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
samdb = SamDB(url="ldap://%s" % server,
|
||||
session_info=system_session(),
|
||||
|
@ -368,11 +368,7 @@ class cmd_domain_provision(Command):
|
||||
plaintext_secrets=False,
|
||||
backend_store=None):
|
||||
|
||||
self.logger = self.get_logger("provision")
|
||||
if quiet:
|
||||
self.logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger = self.get_logger(name="provision", quiet=quiet)
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
smbconf = lp.configfile
|
||||
@ -616,13 +612,7 @@ class cmd_domain_dcpromo(Command):
|
||||
creds = credopts.get_credentials(lp)
|
||||
net = Net(creds, lp, server=credopts.ipaddress)
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
netbios_name = lp.get("netbios name")
|
||||
|
||||
@ -688,13 +678,7 @@ class cmd_domain_join(Command):
|
||||
creds = credopts.get_credentials(lp)
|
||||
net = Net(creds, lp, server=credopts.ipaddress)
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
netbios_name = lp.get("netbios name")
|
||||
|
||||
@ -771,13 +755,7 @@ class cmd_domain_demote(Command):
|
||||
creds = credopts.get_credentials(lp)
|
||||
net = Net(creds, lp, server=credopts.ipaddress)
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
if remove_other_dead_server is not None:
|
||||
if server is not None:
|
||||
@ -1615,13 +1593,7 @@ class cmd_domain_classicupgrade(Command):
|
||||
if not dbdir and not testparm:
|
||||
raise CommandError("Please specify either dbdir or testparm")
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
if dbdir and testparm:
|
||||
logger.warning("both dbdir and testparm specified, ignoring dbdir.")
|
||||
|
@ -38,7 +38,6 @@ from samba.join import join_clone
|
||||
from samba.ndr import ndr_unpack
|
||||
from samba.dcerpc import drsblobs
|
||||
from samba import colour
|
||||
import logging
|
||||
|
||||
|
||||
def drsuapi_connect(ctx):
|
||||
@ -760,13 +759,7 @@ class cmd_drs_clone_dc_database(Command):
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
|
||||
logger = self.get_logger()
|
||||
if verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif quiet:
|
||||
logger.setLevel(logging.WARNING)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger = self.get_logger(verbose=verbose, quiet=quiet)
|
||||
|
||||
if targetdir is None:
|
||||
raise CommandError("--targetdir option must be specified")
|
||||
|
Loading…
x
Reference in New Issue
Block a user