Fix default username and port for SSH client connection

Redefine default SSH port for SSH as None to allow to reconfigure it

Change-Id: I7d7d3eafec04ffbd690a5abeb496325f0fa14607
This commit is contained in:
Federico Ressi 2019-08-12 08:15:12 +02:00
parent b7ef0060c7
commit bf43263335
4 changed files with 11 additions and 7 deletions

View File

@ -15,6 +15,7 @@
# under the License.
from __future__ import absolute_import
import getpass
import os
import socket
import time
@ -105,6 +106,9 @@ class SSHConnectFailure(tobiko.TobikoException):
class SSHClientFixture(tobiko.SharedFixture):
host = None
port = 22
username = getpass.getuser()
client = None
default = tobiko.required_setup_fixture(_config.SSHDefaultConfigFixture)

View File

@ -13,7 +13,6 @@
# under the License.
from __future__ import absolute_import
import getpass
import itertools
from oslo_config import cfg
@ -29,10 +28,10 @@ OPTIONS = [
default='/usr/bin/ssh',
help=('Default SSH client command')),
cfg.StrOpt('port',
default=22,
default=None,
help=('Default SSH port')),
cfg.StrOpt('username',
default=getpass.getuser(),
default=None,
help=('Default SSH username')),
cfg.ListOpt('config_files',
default=['/etc/ssh/ssh_config', '~/.ssh/config'],

View File

@ -33,8 +33,9 @@ class UndercloudConfigTest(unit.TobikoUnitTest):
def test_undercloud_ssh_port(self):
value = self.conf.undercloud_ssh_port
self.assertIsInstance(value, int)
self.assertIn(value, six.moves.range(1, 2 ** 16))
if value is not None:
self.assertIsInstance(value, int)
self.assertIn(value, six.moves.range(1, 2 ** 16))
def test_undercloud_ssh_username(self):
self.assertIsInstance(self.conf.undercloud_ssh_username,

View File

@ -24,8 +24,8 @@ OPTIONS = [
help="hostname or IP address to be used to connect to "
"undercloud host"),
cfg.IntOpt('undercloud_ssh_port',
default=22,
help="TCP port of undercloud port"),
default=None,
help="TCP port of SSH server on undercloud host"),
cfg.StrOpt('undercloud_ssh_username',
default='stack',
help="Username with access to stackrc and overcloudrc files"),