mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
selftest: Port DrsBaseTestCase._{en,dis}able_all_repl() to self.runsubcmd()
This avoids forking a subprocess with self.check_run() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
f7c46ed56c
commit
4cc5ceb297
@ -98,16 +98,6 @@ class DrsBaseTestCase(SambaToolCmdTest):
|
||||
def _make_obj_name(self, prefix):
|
||||
return prefix + time.strftime("%s", time.gmtime())
|
||||
|
||||
def _samba_tool_cmdline(self, drs_command):
|
||||
# find out where is net command
|
||||
samba_tool_cmd = os.path.abspath("./bin/samba-tool")
|
||||
# make command line credentials string
|
||||
creds = self.get_credentials()
|
||||
cmdline_auth = "-U%s/%s%%%s" % (creds.get_domain(),
|
||||
creds.get_username(), creds.get_password())
|
||||
# bin/samba-tool drs <drs_command> <cmdline_auth>
|
||||
return "%s drs %s %s" % (samba_tool_cmd, drs_command, cmdline_auth)
|
||||
|
||||
def _samba_tool_cmd_list(self, drs_command):
|
||||
# make command line credentials string
|
||||
creds = self.get_credentials()
|
||||
@ -154,18 +144,24 @@ class DrsBaseTestCase(SambaToolCmdTest):
|
||||
self.assertEquals(err,"","Shouldn't be any error messages")
|
||||
|
||||
def _enable_all_repl(self, DC):
|
||||
self._enable_inbound_repl(DC)
|
||||
# make base command line
|
||||
samba_tool_cmd = self._samba_tool_cmdline("options")
|
||||
# disable replication
|
||||
self.check_run("%s %s --dsa-option=-DISABLE_INBOUND_REPL" %(samba_tool_cmd, DC))
|
||||
self.check_run("%s %s --dsa-option=-DISABLE_OUTBOUND_REPL" %(samba_tool_cmd, DC))
|
||||
samba_tool_cmd = self._samba_tool_cmd_list("options")
|
||||
# enable replication
|
||||
samba_tool_cmd += [DC, "--dsa-option=-DISABLE_OUTBOUND_REPL"]
|
||||
(result, out, err) = self.runsubcmd(*samba_tool_cmd)
|
||||
self.assertCmdSuccess(result, out, err)
|
||||
self.assertEquals(err,"","Shouldn't be any error messages")
|
||||
|
||||
def _disable_all_repl(self, DC):
|
||||
self._disable_inbound_repl(DC)
|
||||
# make base command line
|
||||
samba_tool_cmd = self._samba_tool_cmdline("options")
|
||||
samba_tool_cmd = self._samba_tool_cmd_list("options")
|
||||
# disable replication
|
||||
self.check_run("%s %s --dsa-option=+DISABLE_INBOUND_REPL" %(samba_tool_cmd, DC))
|
||||
self.check_run("%s %s --dsa-option=+DISABLE_OUTBOUND_REPL" %(samba_tool_cmd, DC))
|
||||
samba_tool_cmd += [DC, "--dsa-option=+DISABLE_OUTBOUND_REPL"]
|
||||
(result, out, err) = self.runsubcmd(*samba_tool_cmd)
|
||||
self.assertCmdSuccess(result, out, err)
|
||||
self.assertEquals(err,"","Shouldn't be any error messages")
|
||||
|
||||
def _get_highest_hwm_utdv(self, ldb_conn):
|
||||
res = ldb_conn.search("", scope=ldb.SCOPE_BASE, attrs=["highestCommittedUSN"])
|
||||
|
Loading…
Reference in New Issue
Block a user