From 22697b5f5bddc8ffc8abd3ea84d4ddfadb4a4122 Mon Sep 17 00:00:00 2001 From: Artom Lifshitz Date: Tue, 22 Jan 2019 15:26:14 -0500 Subject: [PATCH] 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 --- README.rst | 6 ++--- .../api/compute/test_pointer_device_type.py | 6 ----- whitebox_tempest_plugin/config.py | 22 ++++++++++--------- whitebox_tempest_plugin/services/clients.py | 14 ++---------- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/README.rst b/README.rst index b4413257..d7eb7a71 100644 --- a/README.rst +++ b/README.rst @@ -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. :: diff --git a/whitebox_tempest_plugin/api/compute/test_pointer_device_type.py b/whitebox_tempest_plugin/api/compute/test_pointer_device_type.py index 952496e9..02143ce9 100644 --- a/whitebox_tempest_plugin/api/compute/test_pointer_device_type.py +++ b/whitebox_tempest_plugin/api/compute/test_pointer_device_type.py @@ -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 diff --git a/whitebox_tempest_plugin/config.py b/whitebox_tempest_plugin/config.py index 252d848d..56ca1192 100644 --- a/whitebox_tempest_plugin/config.py +++ b/whitebox_tempest_plugin/config.py @@ -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, diff --git a/whitebox_tempest_plugin/services/clients.py b/whitebox_tempest_plugin/services/clients.py index a456184a..87b8f07d 100644 --- a/whitebox_tempest_plugin/services/clients.py +++ b/whitebox_tempest_plugin/services/clients.py @@ -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,