遇到一个ssh的问题,执行ssh命令时报“Pseudo-terminal will not be allocated because stdin is not a terminal”
脚本在server上直接运行虽然也报这个错误,但是端口链接是可以的,但脚本用jenkins run时端口链接失败。
...
tunnelArgs = ["ssh", "-T", "-oStrictHostKeyChecking=no","-oUserKnownHostsFile=/dev/null", "-i",
SshManager.privateKey, "-L",
str(self.tunnelLocalPort) + ":" + host + ":" + str(SSH_DEFAULT_PORT),
self.gatewayUser + "@" + self.gateway]
process = Popen(tunnelArgs, stdout=PIPE)
...
RC:stdin不是终端,但是为什么在server上执行脚本虽然有错但仍然能成功,和jenkins执行的区别还不明白
solution: 加参数 -t -t