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] [whitebox]
hypervisors = compute-0.localdomain:192.168.24.6,compute-1.localdomain:192.168.24.12 hypervisors = compute-0.localdomain:192.168.24.6,compute-1.localdomain:192.168.24.12
target_controller = controller-0.localdomain # Only set the following if different from the defaults listed
target_ssh_user = heat-admin # ctlplane_ssh_username = heat-admin
target_private_key_path = /home/stack/.ssh/id_rsa # ctlplane_ssh_private_key_path = /home/stack/.ssh/id_rsa
containers = true containers = true
3. Execute the tests. :: 3. Execute the tests. ::

View File

@ -13,12 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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 # Parameters required in /etc/nova/nova.conf
# pointer_model=ps2mouse # pointer_model=ps2mouse

View File

@ -21,18 +21,20 @@ group = cfg.OptGroup(
title='Whitebox Tempest plugin config options') title='Whitebox Tempest plugin config options')
opts = [ 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( cfg.StrOpt(
'target_controller', 'ctlplane_ssh_username',
help='Address of a controller node.'), 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( cfg.StrOpt(
'target_ssh_user', 'ctlplane_ssh_private_key_path',
help='Username of the SSH connection.'), help='Path to the private key to use when accessing controllers '
cfg.StrOpt( 'and/or compute hosts over SSH.',
'target_private_key_path', default='/home/stack/.ssh/id_rsa',
help='Path to the private key.'), deprecated_opts=[cfg.DeprecatedOpt('target_private_key_path',
group='whitebox')]),
cfg.BoolOpt( cfg.BoolOpt(
'containers', 'containers',
default=False, default=False,

View File

@ -20,7 +20,6 @@ except ImportError:
from tempest import config from tempest import config
from tempest.lib.common import ssh from tempest.lib.common import ssh
from tempest.lib import exceptions as lib_exc
CONF = config.CONF CONF = config.CONF
@ -31,17 +30,8 @@ class SSHClient(object):
_prefix_command = '/bin/bash -c' _prefix_command = '/bin/bash -c'
def __init__(self): def __init__(self):
# TODO(stephenfin): Workaround for oslo.config bug #1735790. Remove self.ssh_key = CONF.whitebox.ctlplane_ssh_private_key_path
# when oslo.config properly validates required opts registered after self.ssh_user = CONF.whitebox.ctlplane_ssh_username
# 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
def execute(self, hostname=None, cmd=None): def execute(self, hostname=None, cmd=None):
ssh_client = ssh.Client(hostname, self.ssh_user, ssh_client = ssh.Client(hostname, self.ssh_user,