Merge pull request #231 from AurelienLourot/minor-fixes

Fix copy-paste mistakes and typos and remove dead code
This commit is contained in:
Alex Kavanagh
2020-04-16 18:49:32 +01:00
committed by GitHub
16 changed files with 36 additions and 44 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ class AodhTest(test_utils.OpenStackBaseTest):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
+3 -11
View File
@@ -34,7 +34,6 @@ class CeilometerTest(test_utils.OpenStackBaseTest):
XENIAL_NEWTON = openstack_utils.get_os_release('xenial_newton')
XENIAL_MITAKA = openstack_utils.get_os_release('xenial_mitaka')
TRUSTY_MITAKA = openstack_utils.get_os_release('trusty_mitaka')
TRUSTY_LIBERTY = openstack_utils.get_os_release('trusty_liberty')
@classmethod
def setUpClass(cls):
@@ -44,7 +43,7 @@ class CeilometerTest(test_utils.OpenStackBaseTest):
@property
def services(self):
"""Return a list of services for Openstack Release."""
"""Return a list of services for the selected OpenStack release."""
services = []
if self.application_name == 'ceilometer-agent':
@@ -81,21 +80,14 @@ class CeilometerTest(test_utils.OpenStackBaseTest):
services.append('ceilometer-alarm-notifier')
services.append('ceilometer-alarm-evaluator')
# if self.current_release >= CeilometerTest.TRUSTY_LIBERTY:
# Liberty and later
# services.append('ceilometer-polling')
# else:
# Juno and earlier
# services.append('ceilometer-agent-central')
return services
@property
def restartable_services(self):
"""Return a list of services that are known to be restartable.
For Openstack Release these services are known to be able to be stopped
and started with no issues.
For the selected OpenStack release these services are known to be able
to be stopped and started with no issues.
"""
# Due to Bug #1861321 ceilometer-collector does not reliably
# restart.
+3 -3
View File
@@ -153,7 +153,7 @@ class CinderTests(test_utils.OpenStackBaseTest):
@property
def services(self):
"""Return a list services for OpenStack release."""
"""Return a list services for the selected OpenStack release."""
services = ['cinder-scheduler', 'cinder-volume']
if (openstack_utils.get_os_release() >=
openstack_utils.get_os_release('xenial_ocata')):
@@ -165,7 +165,7 @@ class CinderTests(test_utils.OpenStackBaseTest):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
@@ -176,7 +176,7 @@ class CinderTests(test_utils.OpenStackBaseTest):
conf_file = '/etc/cinder/cinder.conf'
# Make config change, check for service restarts
logging.debug('Setting disk format glance...')
logging.debug('Setting debug mode...')
self.restart_on_changed(
conf_file,
set_default,
@@ -40,7 +40,7 @@ class CinderBackupTest(test_utils.OpenStackBaseTest):
@property
def services(self):
"""Return a list services for Openstack Release."""
"""Return a list services for the selected OpenStack release."""
current_release = openstack_utils.get_os_release()
services = ['cinder-scheduler', 'cinder-volume']
if (current_release >=
@@ -95,7 +95,7 @@ class DesignateTests(BaseDesignateTest):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
+1 -1
View File
@@ -44,7 +44,7 @@ class GlanceTest(test_utils.OpenStackBaseTest):
def test_411_set_disk_format(self):
"""Change disk format and check.
Change disk format and assert then change propagates to the correct
Change disk format and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
+1 -1
View File
@@ -28,7 +28,7 @@ class GnocchiTest(test_utils.OpenStackBaseTest):
@property
def services(self):
"""Return a list of services for Openstack Release."""
"""Return a list of services for the selected OpenStack release."""
return ['haproxy', 'gnocchi-metricd', 'apache2']
def test_200_api_connection(self):
+1 -1
View File
@@ -54,7 +54,7 @@ class HeatBasicDeployment(test_utils.OpenStackBaseTest):
@property
def services(self):
"""Return a list services for OpenStack release.
"""Return a list services for the selected OpenStack release.
:returns: List of services
:rtype: [str]
+3 -3
View File
@@ -31,7 +31,7 @@ class CharmKeystoneKerberosTest(BaseKeystoneTest):
super(CharmKeystoneKerberosTest, cls).setUpClass()
def test_keystone_kerberos_authentication(self):
"""Validate auth to Openstack through the kerberos method."""
"""Validate auth to OpenStack through the kerberos method."""
logging.info('Retrieving a kerberos token with kinit for admin user')
ubuntu_test_host = zaza.model.get_units('ubuntu-test-host')[0]
@@ -46,7 +46,7 @@ class CharmKeystoneKerberosTest(BaseKeystoneTest):
)
assert result['Code'] == '0', result['Stderr']
logging.info('Fetching user/project info in Openstack')
logging.info('Fetching user/project info in OpenStack')
domain_name = 'k8s'
project_name = 'k8s'
keystone_session = openstack_utils.get_overcloud_keystone_session()
@@ -56,7 +56,7 @@ class CharmKeystoneKerberosTest(BaseKeystoneTest):
project_id = keystone_client.projects.find(name=project_name).id
keystone_hostname = get_unit_full_hostname('keystone')
logging.info('Retrieving an Openstack token to validate auth')
logging.info('Retrieving an OpenStack token to validate auth')
cmd = 'openstack token issue -f value -c id ' \
'--os-auth-url http://{}:5000/krb/v3 ' \
'--os-project-id {} ' \
+2 -2
View File
@@ -78,7 +78,7 @@ class MySQLCommonTests(MySQLBaseTest):
def test_910_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change max connections and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
@@ -86,7 +86,7 @@ class MySQLCommonTests(MySQLBaseTest):
set_alternate = {"max-connections": "1000"}
# Make config change, check for service restarts
logging.debug("Setting peer timeout ...")
logging.debug("Setting max connections ...")
self.restart_on_changed(
self.conf_file,
set_default,
+1 -1
View File
@@ -81,7 +81,7 @@ def basic_overcloud_network(limit_gws=None):
# Get keystone session
keystone_session = openstack_utils.get_overcloud_keystone_session()
# Handle network for Openstack-on-Openstack scenarios
# Handle network for OpenStack-on-OpenStack scenarios
if juju_utils.get_provider_type() == "openstack":
undercloud_ks_sess = openstack_utils.get_undercloud_keystone_session()
network.setup_gateway_ext_port(network_config,
+2 -2
View File
@@ -113,7 +113,7 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
@@ -285,7 +285,7 @@ class NeutronApiTest(NeutronCreateNetworkTest):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
+1 -1
View File
@@ -75,7 +75,7 @@ class NovaCompute(test_utils.OpenStackBaseTest):
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change.
Change disk format and assert then change propagates to the correct
Change debug mode and assert that change propagates to the correct
file and that services are restarted as a result
"""
# Expected default and alternate values
+1 -1
View File
@@ -259,7 +259,7 @@ class BaseCharmTest(unittest.TestCase):
pgrep_full=False):
"""Run restart on change tests.
Test that changing config results in config file being updates and
Test that changing config results in config file being updated and
services restarted. Return config to default_config afterwards
:param config_file: Config file to check for settings
+1 -1
View File
@@ -284,7 +284,7 @@ def run_from_cli(**kwargs):
network_config = generic_utils.get_network_config(
net_topology, ignore_env_vars, net_topology_file)
# Handle network for Openstack-on-Openstack scenarios
# Handle network for OpenStack-on-OpenStack scenarios
if juju_utils.get_provider_type() == "openstack":
undercloud_ks_sess = openstack_utils.get_undercloud_keystone_session(
verify=cacert)
+13 -13
View File
@@ -14,7 +14,7 @@
"""Module for interacting with OpenStack.
This module contains a number of functions for interacting with Openstack.
This module contains a number of functions for interacting with OpenStack.
"""
from .os_versions import (
OPENSTACK_CODENAMES,
@@ -168,11 +168,11 @@ def get_cacert():
return KEYSTONE_LOCAL_CACERT
# Openstack Client helpers
# OpenStack Client helpers
def get_ks_creds(cloud_creds, scope='PROJECT'):
"""Return the credentials for authenticating against keystone.
:param cloud_creds: Openstack RC environment credentials
:param cloud_creds: OpenStack RC environment credentials
:type cloud_creds: dict
:param scope: Authentication scope: PROJECT or DOMAIN
:type scope: string
@@ -375,7 +375,7 @@ def get_keystone_scope(model_name=None):
def get_keystone_session(openrc_creds, scope='PROJECT', verify=None):
"""Return keystone session.
:param openrc_creds: Openstack RC credentials
:param openrc_creds: OpenStack RC credentials
:type openrc_creds: dict
:param verify: Control TLS certificate verification behaviour
:type verify: any (True - use system certs,
@@ -444,7 +444,7 @@ def get_keystone_session_client(session, client_api_version=3):
def get_keystone_client(openrc_creds, verify=None):
"""Return authenticated keystoneclient and set auth_ref for service_catalog.
:param openrc_creds: Openstack RC credentials
:param openrc_creds: OpenStack RC credentials
:type openrc_creds: dict
:param verify: Control TLS certificate verification behaviour
:type verify: any
@@ -1602,7 +1602,7 @@ def get_undercloud_auth():
return auth_settings
# Openstack Client helpers
# OpenStack Client helpers
def get_keystone_ip(model_name=None):
"""Return the IP address to use when communicating with keystone api.
@@ -2115,7 +2115,7 @@ def create_ssh_key(nova_client, keypair_name, replace=False):
:param nova_client: Authenticated nova client
:type nova_client: novaclient.v2.client.Client
:param keypair_name: Label to apply to keypair in Openstack.
:param keypair_name: Label to apply to keypair in OpenStack.
:type keypair_name: str
:param replace: Whether to replace the existing keypair if it already
exists.
@@ -2138,7 +2138,7 @@ def create_ssh_key(nova_client, keypair_name, replace=False):
def get_private_key_file(keypair_name):
"""Location of the file containing the private key with the given label.
:param keypair_name: Label of keypair in Openstack.
:param keypair_name: Label of keypair in OpenStack.
:type keypair_name: str
:returns: Path to file containing key
:rtype: str
@@ -2149,7 +2149,7 @@ def get_private_key_file(keypair_name):
def write_private_key(keypair_name, key):
"""Store supplied private key in file.
:param keypair_name: Label of keypair in Openstack.
:param keypair_name: Label of keypair in OpenStack.
:type keypair_name: str
:param key: PEM Encoded Private Key
:type key: str
@@ -2161,7 +2161,7 @@ def write_private_key(keypair_name, key):
def get_private_key(keypair_name):
"""Return private key.
:param keypair_name: Label of keypair in Openstack.
:param keypair_name: Label of keypair in OpenStack.
:type keypair_name: str
:returns: PEM Encoded Private Key
:rtype: str
@@ -2175,11 +2175,11 @@ def get_private_key(keypair_name):
def get_public_key(nova_client, keypair_name):
"""Return public key from Openstack.
"""Return public key from OpenStack.
:param nova_client: Authenticated nova client
:type nova_client: novaclient.v2.client.Client
:param keypair_name: Label of keypair in Openstack.
:param keypair_name: Label of keypair in OpenStack.
:type keypair_name: str
:returns: OpenSSH Encoded Public Key
:rtype: str or None
@@ -2196,7 +2196,7 @@ def valid_key_exists(nova_client, keypair_name):
:param nova_client: Authenticated nova client
:type nova_client: novaclient.v2.client.Client
:param keypair_name: Label of keypair in Openstack.
:param keypair_name: Label of keypair in OpenStack.
:type keypair_name: str
"""
pub_key = get_public_key(nova_client, keypair_name)