使用testinfra(pytestplugin)进行测试。我想用私钥测试Jenkins的远程主机。在
[root@jenkins tests]# testinfra --ssh-config=/path/to/private/key \
--sudo --hosts=user@remotehost test.py
在哪里
^{pr2}$以及
$ cat test.py
def test_redis_is_installed(host):
redis = host.package("redis")
assert redis.is_installed
我得到的是
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
必须是ssh配置的路径。您可以在该配置中为主机配置密钥对。在在~/.ssh/config中:
相关问题 更多 >
编程相关推荐