Allow to get host_config and connect parameters before connecting to SSH server

Change-Id: I6423e6fbfac2bd8fe08c0995960e89624440d01e
This commit is contained in:
Federico Ressi 2019-10-10 10:25:16 +02:00
parent 9afc448f94
commit 75f6673aad
2 changed files with 9 additions and 2 deletions

View File

@ -96,6 +96,10 @@ class OpenStackTopologyNode(object):
def add_group(self, group):
self.groups.add(group)
@property
def ssh_parameters(self):
return self.ssh_client.setup_connect_parameters()
def __repr__(self):
return "{cls!s}<name={name!r}>".format(cls=type(self).__name__,
name=self.name)

View File

@ -230,7 +230,6 @@ class SSHClientFixture(tobiko.SharedFixture):
schema=schema, **kwargs)
def setup_fixture(self):
self.setup_host_config()
self.setup_connect_parameters()
self.setup_ssh_client()
@ -238,6 +237,7 @@ class SSHClientFixture(tobiko.SharedFixture):
if not self.host_config:
self.host_config = _config.ssh_host_config(
host=self.host, config_files=self.config_files)
return self.host_config
def setup_connect_parameters(self):
"""Fill connect parameters dict
@ -247,7 +247,10 @@ class SSHClientFixture(tobiko.SharedFixture):
- parameters got from ~/.ssh/config and tobiko.conf
- parameters got from fixture object attributes
"""
self.connect_parameters = self.get_connect_parameters()
self.setup_host_config()
if not self.connect_parameters:
self.connect_parameters = self.get_connect_parameters()
return self.connect_parameters
def get_connect_parameters(self, schema=None):
schema = dict(schema or self.schema)