Remove the content of default-overrides.conf

Move all needed values to the load_basic_defaults method and
remove the rest.
The default-overrides.conf itself will be removed in a following
patch.

Change-Id: I47a12560bee4746efb54eb9b3c841b2783aa15f6
This commit is contained in:
Martin Kopec 2018-06-05 14:16:56 +00:00
parent 02ca23a08d
commit 77fa9ad160
5 changed files with 38 additions and 128 deletions

View File

@ -23,8 +23,6 @@ TEMPEST_WORKSPACE = os.getcwd()
DEPLOYER_INPUT = os.path.join(os.path.expanduser("~"), DEPLOYER_INPUT = os.path.join(os.path.expanduser("~"),
"tempest-deployer-input.conf") "tempest-deployer-input.conf")
DEFAULTS_FILE = os.path.join(TEMPEST_WORKSPACE, "etc",
"default-overrides.conf")
DEFAULT_IMAGE = ("http://download.cirros-cloud.net/0.3.5/" DEFAULT_IMAGE = ("http://download.cirros-cloud.net/0.3.5/"
"cirros-0.3.5-x86_64-disk.img") "cirros-0.3.5-x86_64-disk.img")
DEFAULT_IMAGE_FORMAT = 'qcow2' DEFAULT_IMAGE_FORMAT = 'qcow2'

View File

@ -16,9 +16,7 @@
This script will generate the etc/tempest.conf file by applying a series of This script will generate the etc/tempest.conf file by applying a series of
specified options in the following order: specified options in the following order:
1. Values from etc/default-overrides.conf, if present. This file will be 1. Default values provided by the tool.
provided by the distributor of the tempest code, a distro for example, to
specify defaults that are different than the generic defaults for tempest.
2. Values using the file provided by the --deployer-input argument to the 2. Values using the file provided by the --deployer-input argument to the
script. script.
@ -76,13 +74,19 @@ def load_basic_defaults(conf):
""" """
LOG.debug("Setting basic default values") LOG.debug("Setting basic default values")
default_values = { default_values = {
"DEFAULT": [
("debug", "true"),
("use_stderr", "false"),
("log_file", "tempest.log")
],
"identity": [ "identity": [
("username", "demo"), ("username", "demo"),
("password", "secrete"), ("password", "secrete"),
("project_name", "demo"), ("project_name", "demo"),
("alt_username", "alt_demo"), ("alt_username", "alt_demo"),
("alt_password", "secrete"), ("alt_password", "secrete"),
("alt_project_name", "alt_demo") ("alt_project_name", "alt_demo"),
("disable_ssl_certificate_validation", "true")
], ],
"scenario": [ "scenario": [
("img_dir", "etc") ("img_dir", "etc")
@ -92,10 +96,25 @@ def load_basic_defaults(conf):
("admin_username", "admin"), ("admin_username", "admin"),
("admin_project_name", "admin"), ("admin_project_name", "admin"),
("admin_domain_name", "Default") ("admin_domain_name", "Default")
],
"object-storage": [
("reseller_admin_role", "ResellerAdmin")
],
"oslo-concurrency": [
("lock_path", "/tmp")
],
"compute-feature-enabled": [
# Default deployment does not use shared storage
("live_migration", "false"),
("live_migrate_paused_instances", "true"),
("preserve_ports", "true")
],
"network-feature-enabled": [
("ipv6_subnet_attributes", "true")
]} ]}
for section in default_values.keys(): for section in default_values.keys():
if not conf.has_section(section): if section != "DEFAULT" and not conf.has_section(section):
conf.add_section(section) conf.add_section(section)
for key, value in default_values[section]: for key, value in default_values[section]:
if not conf.has_option(section, key): if not conf.has_option(section, key):
@ -124,7 +143,7 @@ def set_options(conf, deployer_input, non_admin, overrides=[],
no_default_deployer=False): no_default_deployer=False):
"""Set options in conf provided by different source. """Set options in conf provided by different source.
1. read the default values in default-overrides file 1. read the default values
2. read a file provided by --deployer-input argument 2. read a file provided by --deployer-input argument
3. read default DEPLOYER_INPUT if --no-deployer-input is False and no 3. read default DEPLOYER_INPUT if --no-deployer-input is False and no
deployer_input was passed deployer_input was passed
@ -142,11 +161,7 @@ def set_options(conf, deployer_input, non_admin, overrides=[],
:param cloud_creds: Cloud credentials from client's config :param cloud_creds: Cloud credentials from client's config
:type cloud_creds: dict :type cloud_creds: dict
""" """
if os.path.isfile(C.DEFAULTS_FILE): load_basic_defaults(conf)
LOG.info("Reading defaults from file '%s'", C.DEFAULTS_FILE)
conf.read(C.DEFAULTS_FILE)
else:
load_basic_defaults(conf)
if deployer_input and os.path.isfile(deployer_input): if deployer_input and os.path.isfile(deployer_input):
LOG.info("Reading deployer input from file {}".format( LOG.info("Reading deployer input from file {}".format(

View File

@ -15,7 +15,7 @@
import mock import mock
from config_tempest import constants as C from config_tempest import main
from config_tempest.services.object_storage import ObjectStorageService from config_tempest.services.object_storage import ObjectStorageService
from config_tempest import tempest_conf from config_tempest import tempest_conf
from config_tempest.tests.base import BaseServiceTest from config_tempest.tests.base import BaseServiceTest
@ -45,9 +45,9 @@ class TestObjectStorageService(BaseServiceTest):
self.assertItemsEqual(self.Service.get_extensions(), []) self.assertItemsEqual(self.Service.get_extensions(), [])
def test_list_create_roles(self): def test_list_create_roles(self):
conf = tempest_conf.TempestConf() conf = self.Service.conf
# TODO(mkopec) remove reading of default file when it's removed # load default values
conf.read(C.DEFAULTS_FILE) main.load_basic_defaults(self.Service.conf)
client = mock.Mock() client = mock.Mock()
return_mock = mock.Mock(return_value=self.FAKE_ROLES) return_mock = mock.Mock(return_value=self.FAKE_ROLES)
client.list_roles = return_mock client.list_roles = return_mock

View File

@ -1,111 +1,3 @@
[DEFAULT] # The content of the file was moved to the source
# code of python-tempestconf.
# Print debugging output (set logging level to DEBUG instead # The file will removed soon.
# of default WARNING level). (boolean value)
debug=true
# Log output to standard error (boolean value)
use_stderr=false
# (Optional) Name of log file to output to. If no default is
# set, logging will go to stdout. (string value)
# Deprecated group/name - [DEFAULT]/logfile
log_file=tempest.log
[auth]
# Roles to assign to all users created by tempest (list value)
tempest_roles = _member_
# Administrative Username to use for Keystone API requests.
# (string value)
admin_username=admin
# Administrative Tenant name to use for Keystone API requests.
# (string value)
admin_project_name=admin
admin_domain_name=Default
[identity]
# Full URI of the OpenStack Identity API (Keystone), v3
# (string value)
#uri_v3=<None> $$$ DERIVE from uri
# Username to use for Nova API requests. (string value)
username=demo
# Tenant name to use for Nova API requests. (string value)
project_name=demo
# API key to use when authenticating. (string value)
password=secrete
# Username of alternate user to use for Nova API requests.
# (string value)
alt_username=alt_demo
# Alternate user's Tenant name to use for Nova API requests.
# (string value)
alt_project_name=alt_demo
# API key to use when authenticating as alternate user.
# (string value)
alt_password=secrete
admin_domain_name=Default
disable_ssl_certificate_validation=true
[object-storage]
# default-overrides.conf file will be removed soon, this value will be
# moved to load_basic_defaults method in config_tempest/main.py
reseller_admin_role = ResellerAdmin
[data-processing]
[orchestration]
# Name of heat-cfntools enabled image to use when launching
# test instances. (string value)
#image_ref=<None> $$$ Not sure
# Name of existing keypair to launch servers with. (string
# value)
#keypair_name=<None> $$$ Not sure
[scenario]
#
# Options defined in tempest.config
#
# Directory containing image files (string value)
img_dir=etc
[oslo_concurrency]
# Directory to use for lock files. (string value)
lock_path=/tmp
[volume-feature-enabled]
# Added in kilo
bootable=true
# It needs to be true since mitaka
# this option expected to be removed after liberty EOL
volume_services=true
[compute-feature-enabled]
# Default deployment does not use shared storage
live_migration=false
# Added in kilo
live_migrate_paused_instances=true
preserve_ports=true
[network-feature-enabled]
# Added in juno
ipv6_subnet_attributes=true

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
etc/default-overrides.conf is removed and is no longer used or read.
Important default values were moved to load_basic_defaults method.