LGTM, thanks.
On Tue, Feb 18, 2014 at 3:39 PM, Hrvoje Ribicic <[email protected]> wrote: > The SSH multiplexer is used by default in every connection made, and > when multiple threads are used, this causes strange issues when running > the QA locally. This patch allows the multiplexer to be bypassed, > making a new connection every time. > > Signed-off-by: Hrvoje Ribicic <[email protected]> > --- > qa/qa_utils.py | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/qa/qa_utils.py b/qa/qa_utils.py > index 213eb74..a868566 100644 > --- a/qa/qa_utils.py > +++ b/qa/qa_utils.py > @@ -225,7 +225,8 @@ def AssertRedirectedCommand(cmd, fail=False, > node=None, log_cmd=True): > fail=fail, node=node, log_cmd=log_cmd) > > > -def GetSSHCommand(node, cmd, strict=True, opts=None, tty=None): > +def GetSSHCommand(node, cmd, strict=True, opts=None, tty=None, > + use_multiplexer=True): > """Builds SSH command to be executed. > > @type node: string > @@ -239,6 +240,8 @@ def GetSSHCommand(node, cmd, strict=True, opts=None, > tty=None): > @param opts: list of additional options > @type tty: boolean or None > @param tty: if we should use tty; if None, will be auto-detected > + @type use_multiplexer: boolean > + @param use_multiplexer: if the multiplexer for the node should be used > > """ > args = ["ssh", "-oEscapeChar=none", "-oBatchMode=yes", "-lroot"] > @@ -258,7 +261,7 @@ def GetSSHCommand(node, cmd, strict=True, opts=None, > tty=None): > args.append("-oForwardAgent=yes") > if opts: > args.extend(opts) > - if node in _MULTIPLEXERS: > + if node in _MULTIPLEXERS and use_multiplexer: > spath = _MULTIPLEXERS[node][0] > args.append("-oControlPath=%s" % spath) > args.append("-oControlMaster=no") > @@ -335,7 +338,8 @@ def CloseMultiplexers(): > utils.RemoveFile(sname) > > > -def GetCommandOutput(node, cmd, tty=None, fail=False): > +def GetCommandOutput(node, cmd, tty=None, use_multiplexer=True, > + fail=False): > """Returns the output of a command executed on the given node. > > @type node: string > @@ -344,11 +348,15 @@ def GetCommandOutput(node, cmd, tty=None, > fail=False): > @param cmd: command to be executed in the node (cannot be empty or None) > @type tty: bool or None > @param tty: if we should use tty; if None, it will be auto-detected > + @type use_multiplexer: bool > + @param use_multiplexer: if the SSH multiplexer provided by the QA > should be > + used or not > @type fail: bool > @param fail: whether the command is expected to fail > """ > assert cmd > - p = StartLocalCommand(GetSSHCommand(node, cmd, tty=tty), > + p = StartLocalCommand(GetSSHCommand(node, cmd, tty=tty, > + use_multiplexer=use_multiplexer), > stdout=subprocess.PIPE) > rcode = p.wait() > _AssertRetCode(rcode, fail, cmd, node) > -- > 1.9.0.rc1.175.g0b1dcb5 > >
