예제 #1
0
파일: util.py 프로젝트: f2nd/yandex-tank
 def execute(self, cmd):
     logger.info("Execute on %s: %s", self.host, cmd)
     with self.connect() as client:
         _, stdout, stderr = client.exec_command(cmd)
         output = stdout.read()
         errors = stderr.read()
         err_code = stdout.channel.recv_exit_status()
     return output, errors, err_code
예제 #2
0
 def execute(self, cmd):
     logger.info("Execute on %s: %s", self.host, cmd)
     with self.connect() as client:
         _, stdout, stderr = client.exec_command(cmd)
         output = stdout.read()
         errors = stderr.read()
         err_code = stdout.channel.recv_exit_status()
     return output, errors, err_code
예제 #3
0
def exec_command(client, cmd: str) -> str:
    """Выполняет команду на ssh-сервере"""
    stdin, stdout, stderr = client.exec_command(cmd)
    data = stdout.read() + stderr.read()
    return data.decode('utf-8')