Code Review
/
yardstick.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Heatstack create: fix str/bytes error in NamedTemporaryFile.write()"
[yardstick.git]
/
yardstick
/
ssh.py
diff --git
a/yardstick/ssh.py
b/yardstick/ssh.py
index
a024cf6
..
6ddf327
100644
(file)
--- a/
yardstick/ssh.py
+++ b/
yardstick/ssh.py
@@
-64,6
+64,7
@@
Eventlet:
"""
from __future__ import absolute_import
import os
"""
from __future__ import absolute_import
import os
+import io
import select
import socket
import time
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
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
class SSHError(Exception):
pass
@@
-370,6
+379,12
@@
class SSH(object):
with SCPClient(client.get_transport()) as scp:
scp.put(files, remote_path, recursive)
with SCPClient(client.get_transport()) as scp:
scp.put(files, remote_path, recursive)
+ def get(self, remote_path, local_path='/tmp/', recursive=True):
+ client = self._get_client()
+
+ with SCPClient(client.get_transport()) as scp:
+ scp.get(remote_path, local_path, recursive)
+
# keep shell running in the background, e.g. screen
def send_command(self, command):
client = self._get_client()
# keep shell running in the background, e.g. screen
def send_command(self, command):
client = self._get_client()
@@
-432,8
+447,9
@@
class SSH(object):
class AutoConnectSSH(SSH):
class AutoConnectSSH(SSH):
+ # always wait or we will get OpenStack SSH errors
def __init__(self, user, host, port=None, pkey=None,
def __init__(self, user, host, port=None, pkey=None,
- key_filename=None, password=None, name=None, wait=
Fals
e):
+ key_filename=None, password=None, name=None, wait=
Tru
e):
super(AutoConnectSSH, self).__init__(user, host, port, pkey, key_filename, password, name)
self._wait = wait
super(AutoConnectSSH, self).__init__(user, host, port, pkey, key_filename, password, name)
self._wait = wait