Using testinfra (Pytest plugin) for testing. I want to test remote hosts from Jenkins using a private key.
[root@jenkins tests]# testinfra --ssh-config=/path/to/private/key \
--sudo --hosts=user@remotehost test.py
where
$ cat /path/to/private/key
-----BEGIN RSA PRIVATE KEY-----
(...)
-----END RSA PRIVATE KEY-----
and
$ cat test.py
def test_redis_is_installed(host):
redis = host.package("redis")
assert redis.is_installed
What I get is
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 ========================================================================
Seems like paramiko doesn't like this format, but tried other backends and it doesn't work as well. How can I pass the private key then?