Fix support for multiple SSH key files

Change-Id: I313fba4c4aba493ffbd994c933ae30f6649d581c
This commit is contained in:
Federico Ressi 2019-10-23 16:38:13 +02:00
parent c5fc1effe1
commit 5225b13540

View File

@ -24,6 +24,7 @@ import time
import paramiko
from oslo_log import log
import six
import tobiko
from tobiko.shell.ssh import _config
@ -69,6 +70,12 @@ def positive_int(value):
return value
def key_filename(value):
if isinstance(value, six.string_types):
value = [value]
return [os.path.realpath(os.path.expanduser(v)) for v in value]
SSH_CONNECT_PARAMETERS = {
#: The server to connect to
'hostname': valid_hostname,
@ -88,7 +95,7 @@ SSH_CONNECT_PARAMETERS = {
#: The filename, or list of filenames, of optional private key(s) and/or
#: certs to try for authentication
'key_filename': os.path.expanduser,
'key_filename': key_filename,
#: An optional timeout (in seconds) for the TCP connect
'timeout': positive_float,