Merge "Fix octavia-tempest-plugin on old tempest releases"

This commit is contained in:
Zuul 2022-02-09 15:30:24 +00:00 committed by Gerrit Code Review
commit a3a95b132e
2 changed files with 17 additions and 4 deletions

View File

@ -186,7 +186,7 @@ class ActiveStandbyIptablesScenarioTest(
linux_client = remote_client.RemoteClient( linux_client = remote_client.RemoteClient(
amp['lb_network_ip'], CONF.load_balancer.amphora_ssh_user, amp['lb_network_ip'], CONF.load_balancer.amphora_ssh_user,
pkey=ssh_key, pkey=ssh_key,
ssh_key_type=CONF.validation.ssh_key_type) **cls.remote_client_args())
linux_client.validate_authentication() linux_client.validate_authentication()
# Allow logging from non-init namespaces # Allow logging from non-init namespaces
@ -204,7 +204,7 @@ class ActiveStandbyIptablesScenarioTest(
ssh_key = cls._get_amphora_ssh_key() ssh_key = cls._get_amphora_ssh_key()
linux_client = remote_client.RemoteClient( linux_client = remote_client.RemoteClient(
ip_address, CONF.load_balancer.amphora_ssh_user, pkey=ssh_key, 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() linux_client.validate_authentication()
try: try:

View File

@ -22,6 +22,7 @@ import subprocess
import tempfile import tempfile
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tempest import config from tempest import config
@ -582,6 +583,18 @@ class LoadBalancerBaseTest(validators.ValidatorsMixin,
class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest): 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 @classmethod
def resource_setup(cls): def resource_setup(cls):
super(LoadBalancerBaseTestWithCompute, cls).resource_setup() super(LoadBalancerBaseTestWithCompute, cls).resource_setup()
@ -1008,7 +1021,7 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
linux_client = remote_client.RemoteClient( linux_client = remote_client.RemoteClient(
ip_address, CONF.validation.image_ssh_user, pkey=ssh_key, 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.validate_authentication()
with tempfile.NamedTemporaryFile() as key: with tempfile.NamedTemporaryFile() as key:
@ -1070,7 +1083,7 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
ipv6_address, ipv6_prefix): ipv6_address, ipv6_prefix):
linux_client = remote_client.RemoteClient( linux_client = remote_client.RemoteClient(
ip_address, CONF.validation.image_ssh_user, pkey=ssh_key, 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.validate_authentication()
linux_client.exec_command('sudo ip address add {0}/{1} dev ' linux_client.exec_command('sudo ip address add {0}/{1} dev '