diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-12 09:41:45 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-15 15:32:11 -0700 |
commit | be06e38960cea8a54c85418948e8453861012d2d (patch) | |
tree | 03847348fc74492f4e298d023bbbbb8b76388185 /yardstick/ssh.py | |
parent | 3016786696b9e5a26b364cb5bd4cb5676420fe58 (diff) |
Generate pod.yaml from current context
We want to generate pod.yaml from Heat contexts so we can
re-use the context without destroying it.
But we don't have node role information and it doesn't
make sense in this case, so make the role optional.
Since we changed Heat to use pkey instead of key_filename,
we can embed the pkey into the pod.yaml, but we have
to make sure to convert the pkey to string, in case
it is a RSAKey object
Change-Id: Ibefcfbd8236e68013a704c39964cb870da825da8
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/ssh.py')
-rw-r--r-- | yardstick/ssh.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/yardstick/ssh.py b/yardstick/ssh.py index bb715e4b4..e98ee98b7 100644 --- a/yardstick/ssh.py +++ b/yardstick/ssh.py @@ -64,6 +64,7 @@ Eventlet: """ from __future__ import absolute_import import os +import io import select import socket import time @@ -81,6 +82,14 @@ from yardstick.common.utils import try_int from yardstick.network_services.utils import provision_tool +def convert_key_to_str(key): + if not isinstance(key, (paramiko.RSAKey, paramiko.DSSKey)): + return key + k = io.StringIO() + key.write_private_key(k) + return k.getvalue() + + class SSHError(Exception): pass |