Fix octavia-tempest-plugin on old tempest releases
This is a follow-up commit for 'Add type to allow ECDSA keys' (I34ac429ab5442cef056ee8b63fcb2ba41e8b9b27), this commit allows using octavia-tempest-plugin with older tempest releases (ex: in our jobs on stable/train). It catches the exception if [validation].ssh_key_type is not supported and doesn't pass the ssh_key_type argument to tempest functions. Change-Id: I5c2db87975803b30ea230c3bbf5dab4b96da4614
This commit is contained in:
parent
d0ea406ee4
commit
b0da4f3ce5
@ -186,7 +186,7 @@ class ActiveStandbyIptablesScenarioTest(
|
||||
linux_client = remote_client.RemoteClient(
|
||||
amp['lb_network_ip'], CONF.load_balancer.amphora_ssh_user,
|
||||
pkey=ssh_key,
|
||||
ssh_key_type=CONF.validation.ssh_key_type)
|
||||
**cls.remote_client_args())
|
||||
linux_client.validate_authentication()
|
||||
|
||||
# Allow logging from non-init namespaces
|
||||
@ -204,7 +204,7 @@ class ActiveStandbyIptablesScenarioTest(
|
||||
ssh_key = cls._get_amphora_ssh_key()
|
||||
linux_client = remote_client.RemoteClient(
|
||||
ip_address, CONF.load_balancer.amphora_ssh_user, pkey=ssh_key,
|
||||
ssh_key_type=CONF.validation.ssh_key_type)
|
||||
**cls.remote_client_args())
|
||||
linux_client.validate_authentication()
|
||||
|
||||
try:
|
||||
|
@ -21,6 +21,7 @@ import subprocess
|
||||
import tempfile
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
from tempest import config
|
||||
@ -581,6 +582,18 @@ class LoadBalancerBaseTest(validators.ValidatorsMixin,
|
||||
|
||||
|
||||
class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
|
||||
@classmethod
|
||||
def remote_client_args(cls):
|
||||
# In case we're using octavia-tempest-plugin with old tempest releases
|
||||
# (for instance on stable/train) that don't support ssh_key_type, catch
|
||||
# the exception and don't pass any argument
|
||||
args = {}
|
||||
try:
|
||||
args['ssh_key_type'] = CONF.validation.ssh_key_type
|
||||
except cfg.NoSuchOptError:
|
||||
pass
|
||||
return args
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(LoadBalancerBaseTestWithCompute, cls).resource_setup()
|
||||
@ -982,7 +995,7 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
|
||||
|
||||
linux_client = remote_client.RemoteClient(
|
||||
ip_address, CONF.validation.image_ssh_user, pkey=ssh_key,
|
||||
ssh_key_type=CONF.validation.ssh_key_type)
|
||||
**cls.remote_client_args())
|
||||
linux_client.validate_authentication()
|
||||
|
||||
with tempfile.NamedTemporaryFile() as key:
|
||||
@ -1038,7 +1051,7 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
|
||||
ipv6_address, ipv6_prefix):
|
||||
linux_client = remote_client.RemoteClient(
|
||||
ip_address, CONF.validation.image_ssh_user, pkey=ssh_key,
|
||||
ssh_key_type=CONF.validation.ssh_key_type)
|
||||
**cls.remote_client_args())
|
||||
linux_client.validate_authentication()
|
||||
|
||||
linux_client.exec_command('sudo ip address add {0}/{1} dev '
|
||||
|
Loading…
x
Reference in New Issue
Block a user