Python 使用私钥执行Testinfra ssh
使用testinfra(Pytest插件)进行测试。我想使用私钥从Jenkins测试远程主机Python 使用私钥执行Testinfra ssh,python,ssh,tdd,pytest,private-key,Python,Ssh,Tdd,Pytest,Private Key,使用testinfra(Pytest插件)进行测试。我想使用私钥从Jenkins测试远程主机 [root@jenkins tests]# testinfra --ssh-config=/path/to/private/key \ --sudo --hosts=user@remotehost test.py 在哪里 及 我得到的是 E Exception: Unparsable line -----BEGIN RSA PRIVATE KEY----- /u
[root@jenkins tests]# testinfra --ssh-config=/path/to/private/key \
--sudo --hosts=user@remotehost test.py
在哪里
及
我得到的是
E Exception: Unparsable line -----BEGIN RSA PRIVATE KEY-----
/usr/lib/python2.7/site-packages/paramiko/config.py:68: Exception
================================================================================= warnings summary ==================================================================================
None
Module already imported so can not be re-written: testinfra
-- Docs: http://doc.pytest.org/en/latest/warnings.html
======================================================================= 1 failed, 1 warnings in 0.23 seconds ========================================================================
似乎paramiko不喜欢这种格式,但尝试了其他后端,但效果并不理想。那么如何传递私钥呢?--ssh config
必须是sshconfig的路径。您可以在该配置中为主机配置密钥对
类似于~/.ssh/config:
Host remotehost
User user
IdentityFile remotehost-key
E Exception: Unparsable line -----BEGIN RSA PRIVATE KEY-----
/usr/lib/python2.7/site-packages/paramiko/config.py:68: Exception
================================================================================= warnings summary ==================================================================================
None
Module already imported so can not be re-written: testinfra
-- Docs: http://doc.pytest.org/en/latest/warnings.html
======================================================================= 1 failed, 1 warnings in 0.23 seconds ========================================================================
Host remotehost
User user
IdentityFile remotehost-key