diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-07-06 16:11:12 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-07-28 00:25:14 +0200 |
commit | 4cc5ceb297e310f749d7449b38207dd70554a009 (patch) | |
tree | de78f9d9581b3498115e7127d9de98efc2ef02b2 /source4/torture/drs | |
parent | f7c46ed56c1473f3faa58a4e3e588451b84776b2 (diff) | |
download | samba-4cc5ceb297e310f749d7449b38207dd70554a009.tar.gz |
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>
Diffstat (limited to 'source4/torture/drs')
-rw-r--r-- | source4/torture/drs/python/drs_base.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index 03131d7a74d..c215003b3fb 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -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"]) |