Improve SSH config options

`target_controller` is not used by anything, remove it. Rename the
`target_` options to something more indicative of their real meaning,
and give them defaults that are sensible in an OSP deployment.

Change-Id: Id1e05cda37ba20a6d806e84bcf7ccf8c6a938aec
This commit is contained in:
Artom Lifshitz 2019-01-22 15:26:14 -05:00
parent d805aa9c0b
commit 22697b5f5b
4 changed files with 17 additions and 31 deletions

View File

@ -53,9 +53,9 @@ Install, configure and run
[whitebox]
hypervisors = compute-0.localdomain:192.168.24.6,compute-1.localdomain:192.168.24.12
target_controller = controller-0.localdomain
target_ssh_user = heat-admin
target_private_key_path = /home/stack/.ssh/id_rsa
# Only set the following if different from the defaults listed
# ctlplane_ssh_username = heat-admin
# ctlplane_ssh_private_key_path = /home/stack/.ssh/id_rsa
containers = true
3. Execute the tests. ::

View File

@ -13,12 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
#
# Parameters required in etc/tempest.conf
# [whitebox]
# target_controller=
# target_ssh_user=
# target_private_key_path=
#
# Parameters required in /etc/nova/nova.conf
# pointer_model=ps2mouse

View File

@ -21,18 +21,20 @@ group = cfg.OptGroup(
title='Whitebox Tempest plugin config options')
opts = [
# NOTE(stephenfin): The below options are all required, but because of
# oslo.config bug #1735790 simply adding the 'required' option won't work.
# When that bug is resolved, however, we should use this option.
cfg.StrOpt(
'target_controller',
help='Address of a controller node.'),
'ctlplane_ssh_username',
help='Username to use when accessing controllers and/or compute hosts '
'over SSH.',
default='heat-admin',
deprecated_opts=[cfg.DeprecatedOpt('target_ssh_user',
group='whitebox')]),
cfg.StrOpt(
'target_ssh_user',
help='Username of the SSH connection.'),
cfg.StrOpt(
'target_private_key_path',
help='Path to the private key.'),
'ctlplane_ssh_private_key_path',
help='Path to the private key to use when accessing controllers '
'and/or compute hosts over SSH.',
default='/home/stack/.ssh/id_rsa',
deprecated_opts=[cfg.DeprecatedOpt('target_private_key_path',
group='whitebox')]),
cfg.BoolOpt(
'containers',
default=False,

View File

@ -20,7 +20,6 @@ except ImportError:
from tempest import config
from tempest.lib.common import ssh
from tempest.lib import exceptions as lib_exc
CONF = config.CONF
@ -31,17 +30,8 @@ class SSHClient(object):
_prefix_command = '/bin/bash -c'
def __init__(self):
# TODO(stephenfin): Workaround for oslo.config bug #1735790. Remove
# when oslo.config properly validates required opts registered after
# basic initialization
for opt in ['target_private_key_path', 'target_ssh_user',
'target_controller']:
if getattr(CONF.whitebox, opt) is None:
msg = 'You must configure whitebox.%s' % opt
raise lib_exc.InvalidConfiguration(msg)
self.ssh_key = CONF.whitebox.target_private_key_path
self.ssh_user = CONF.whitebox.target_ssh_user
self.ssh_key = CONF.whitebox.ctlplane_ssh_private_key_path
self.ssh_user = CONF.whitebox.ctlplane_ssh_username
def execute(self, hostname=None, cmd=None):
ssh_client = ssh.Client(hostname, self.ssh_user,