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)
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)
def runExpect(command, events, exitOnFail=True, timeout=None): return sbpexpect.runExpect(command, events, exitOnFail, timeout=timeout)
def runExpect(command, events, exitOnFail = True, timeout=None) : return sbpexpect.runExpect(command, events, exitOnFail, timeout=timeout)