Revision 50265802

b/qa/qa_utils.py
148 148
  return rcode
149 149

  
150 150

  
151
def GetSSHCommand(node, cmd, strict=True, opts=None):
151
def GetSSHCommand(node, cmd, strict=True, opts=None, tty=True):
152 152
  """Builds SSH command to be executed.
153 153

  
154 154
  @type node: string
......
160 160
  @param strict: whether to enable strict host key checking
161 161
  @type opts: list
162 162
  @param opts: list of additional options
163
  @type tty: Bool
164
  @param tty: If we should use tty
163 165

  
164 166
  """
165
  args = [ 'ssh', '-oEscapeChar=none', '-oBatchMode=yes', '-l', 'root', '-t' ]
167
  args = ["ssh", "-oEscapeChar=none", "-oBatchMode=yes", "-l", "root"]
168

  
169
  if tty:
170
    args.append("-t")
166 171

  
167 172
  if strict:
168 173
    tmp = 'yes'
......
227 232
    utils.RemoveFile(sname)
228 233

  
229 234

  
230
def GetCommandOutput(node, cmd):
235
def GetCommandOutput(node, cmd, tty=True):
231 236
  """Returns the output of a command executed on the given node.
232 237

  
233 238
  """
234
  p = StartLocalCommand(GetSSHCommand(node, cmd), stdout=subprocess.PIPE)
239
  p = StartLocalCommand(GetSSHCommand(node, cmd, tty=tty),
240
                        stdout=subprocess.PIPE)
235 241
  AssertEqual(p.wait(), 0)
236 242
  return p.stdout.read()
237 243

  

Also available in: Unified diff