Honour ssh_key_type config for keypair and ssh clients

With [1] Tempest added support for 'ecdsa' key types
using a new config option validation.ssh_key_type.

Let's honour this while creating ssh and keypair
clients. This is needed atleast for latest openssl
package in CentOS 9-stream where support for 'rsa'
key is dropped.

[1] https://review.opendev.org/c/openstack/tempest/+/807465

Closes-Bug: #1963907
Change-Id: I1e4621ca9c02231d02df09fa758eae5c55eb0f93
This commit is contained in:
yatinkarel 2022-03-08 19:25:10 +05:30
parent 2eb433573c
commit 2ad4d583ec
5 changed files with 9 additions and 4 deletions

View File

@ -89,7 +89,8 @@ class Manager(clients.ServiceClients):
self.interfaces_client = interfaces_client.InterfacesClient( self.interfaces_client = interfaces_client.InterfacesClient(
self.auth_provider, **params) self.auth_provider, **params)
self.keypairs_client = keypairs_client.KeyPairsClient( self.keypairs_client = keypairs_client.KeyPairsClient(
self.auth_provider, **params) self.auth_provider, ssh_key_type=CONF.validation.ssh_key_type,
**params)
self.hv_client = hypervisor_client.HypervisorClient( self.hv_client = hypervisor_client.HypervisorClient(
self.auth_provider, **params) self.auth_provider, **params)
self.az_client = availability_zone_client.AvailabilityZoneClient( self.az_client = availability_zone_client.AvailabilityZoneClient(

View File

@ -62,7 +62,8 @@ class Client(ssh.Client):
host=host, username=username, password=password, timeout=timeout, host=host, username=username, password=password, timeout=timeout,
pkey=pkey, channel_timeout=channel_timeout, pkey=pkey, channel_timeout=channel_timeout,
look_for_keys=look_for_keys, key_filename=key_filename, port=port, look_for_keys=look_for_keys, key_filename=key_filename, port=port,
proxy_client=proxy_client) proxy_client=proxy_client,
ssh_key_type=CONF.validation.ssh_key_type)
@classmethod @classmethod
def create_proxy_client(cls, look_for_keys=True, **kwargs): def create_proxy_client(cls, look_for_keys=True, **kwargs):

View File

@ -46,6 +46,7 @@ class FWaaSScenarioTestBase(object):
try: try:
client = ssh.Client(ip_address, username, pkey=private_key, client = ssh.Client(ip_address, username, pkey=private_key,
channel_timeout=connect_timeout, channel_timeout=connect_timeout,
ssh_key_type=CONF.validation.ssh_key_type,
**kwargs) **kwargs)
client.test_connection_auth() client.test_connection_auth()
self.assertTrue(should_connect, "Unexpectedly reachable") self.assertTrue(should_connect, "Unexpectedly reachable")

View File

@ -214,7 +214,8 @@ class Bgp(BgpClientMixin, base.BaseTempestTestCase):
left_server = self._create_server() left_server = self._create_server()
ssh_client = ssh.Client(left_server['fip']['floating_ip_address'], ssh_client = ssh.Client(left_server['fip']['floating_ip_address'],
CONF.validation.image_ssh_user, CONF.validation.image_ssh_user,
pkey=self.keypair['private_key']) pkey=self.keypair['private_key'],
ssh_key_type=CONF.validation.ssh_key_type)
# check LEFT -> RIGHT connectivity via BGP advertised routes # check LEFT -> RIGHT connectivity via BGP advertised routes
self.check_remote_connectivity( self.check_remote_connectivity(

View File

@ -233,7 +233,8 @@ class Vpnaas(base.BaseTempestTestCase):
left_server = self._create_server() left_server = self._create_server()
ssh_client = ssh.Client(left_server['fip']['floating_ip_address'], ssh_client = ssh.Client(left_server['fip']['floating_ip_address'],
CONF.validation.image_ssh_user, CONF.validation.image_ssh_user,
pkey=self.keypair['private_key']) pkey=self.keypair['private_key'],
ssh_key_type=CONF.validation.ssh_key_type)
# check LEFT -> RIGHT connectivity via VPN # check LEFT -> RIGHT connectivity via VPN
self.check_remote_connectivity(ssh_client, right_ip, self.check_remote_connectivity(ssh_client, right_ip,