コード例 #1
0
ファイル: ssh.py プロジェクト: blundeln/smartbox
def runSSHCommand(username, host, command, port=None, password=None, timeout=TIMEOUT) :
  sshCommand = """ssh %s@%s %s "%s" """ % (username, host, port and "-p %s" % port or "", command)
  debugOutput("running ssh command: %s" % sshCommand)
  if password :
    return sbpexpect.runExpect(sshCommand, events={"assword": "%s\n" % password,"yes/no":"yes\n"}, timeout=timeout)
  else :
    return sbpexpect.expect(sshCommand, [[".*", None]], timeout=timeout)
コード例 #2
0
ファイル: ssh.py プロジェクト: blundeln/smartbox
def runSSHCommand(username,
                  host,
                  command,
                  port=None,
                  password=None,
                  timeout=TIMEOUT):
    sshCommand = """ssh %s@%s %s "%s" """ % (username, host, port
                                             and "-p %s" % port or "", command)
    debugOutput("running ssh command: %s" % sshCommand)
    if password:
        return sbpexpect.runExpect(sshCommand,
                                   events={
                                       "assword": "%s\n" % password,
                                       "yes/no": "yes\n"
                                   },
                                   timeout=timeout)
    else:
        return sbpexpect.expect(sshCommand, [[".*", None]], timeout=timeout)
コード例 #3
0
ファイル: system.py プロジェクト: blundeln/smartbox
def runExpect(command, events, exitOnFail=True, timeout=None):
    return sbpexpect.runExpect(command, events, exitOnFail, timeout=timeout)
コード例 #4
0
ファイル: system.py プロジェクト: blundeln/smartbox
def runExpect(command, events, exitOnFail = True, timeout=None) :
  return sbpexpect.runExpect(command, events, exitOnFail, timeout=timeout)