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:
parent
b7ef0060c7
commit
bf43263335
@ -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)
|
||||
|
@ -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'],
|
||||
|
@ -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,
|
||||
|
@ -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"),
|
||||
|
Loading…
Reference in New Issue
Block a user