test-framework: Allow remote execution using ProxyJump

Uses configuration from SSH config

Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski
2023-08-01 11:29:48 +02:00
parent e1401fda34
commit d2835c1059
2 changed files with 57 additions and 19 deletions

View File

@@ -133,19 +133,20 @@ def __presetup(cls):
if cls.config['type'] == 'ssh':
try:
IP(cls.config['ip'])
cls.config['host'] = cls.config['ip']
except ValueError:
TestRun.block("IP address from config is in invalid format.")
except KeyError:
if 'host' not in cls.config:
TestRun.block("No IP address or host defined in config")
port = cls.config.get('port', 22)
if 'user' in cls.config:
cls.executor = SshExecutor(
cls.config['ip'],
cls.config['user'],
port
)
else:
TestRun.block("There is no user given in config.")
cls.executor = SshExecutor(
cls.config['host'],
cls.config.get('user', None),
port
)
elif cls.config['type'] == 'local':
cls.executor = LocalExecutor()
else: