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
diff --git a/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby_iptables.py b/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby_iptables.py
index 397b98b..e7dccb6 100644
--- a/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby_iptables.py
+++ b/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby_iptables.py
@@ -186,7 +186,7 @@
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 @@
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:
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index d9562c6..1c25d25 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -21,6 +21,7 @@
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
@@ -582,6 +583,18 @@
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()
# If validation is disabled in this cloud, we won't be able to
@@ -982,7 +995,7 @@
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 @@
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 '