return SamDB(url=opts.H, session_info=system_session(),
credentials=creds, lp=lp)
- def _run(self, *argv):
+ @classmethod
+ def _run(cls, *argv):
"""run a samba-tool command"""
cmd, args = cmd_sambatool()._resolve('samba-tool', *argv,
- outf=self.stringIO(),
- errf=self.stringIO())
+ outf=cls.stringIO(),
+ errf=cls.stringIO())
result = cmd._run(*args)
return (result, cmd.outf.getvalue(), cmd.errf.getvalue())
if len(result) == 1:
return result[0]
- def _run(self, *argv):
+ @classmethod
+ def _run(cls, *argv):
"""Override _run, so we don't always have to pass host and creds."""
args = list(argv)
- args.extend(["-H", self.host, self.creds])
+ args.extend(["-H", cls.host, cls.creds])
return super()._run(*args)
runcmd = _run
claim_types_dn.add_child("CN=Claim Types,CN=Claims Configuration")
return claim_types_dn
- def _run(self, *argv):
+ @classmethod
+ def _run(cls, *argv):
"""Override _run, so we don't always have to pass host and creds."""
args = list(argv)
- args.extend(["-H", self.host, self.creds])
+ args.extend(["-H", cls.host, cls.creds])
return super()._run(*args)
runcmd = _run
'--color=no', '-S')
self.assertCmdSuccess(result, monochrome, err)
self.assert_colour(monochrome, False)
+ cls = self.__class__
try:
- self.stringIO = StringIOThinksItIsATTY
+ cls.stringIO = StringIOThinksItIsATTY
old_no_color = os.environ.pop('NO_COLOR', None)
# First with no NO_COLOR env var. There should be colour.
result, out, err = self.runsubcmd("visualize", "ntdsconn",
self.assert_colour(out, is_colour, monochrome)
finally:
- self.stringIO = StringIO
+ cls.stringIO = StringIO
if old_no_color is None:
os.environ.pop('NO_COLOR', None)
else: