Rename tobiko.conf options and split openstack config module
Change-Id: Idce1f040f8079783bb0e9b528ffa82450d1d6c19
This commit is contained in:
parent
6746d08357
commit
af272c88a3
@ -23,16 +23,18 @@ function configure_tobiko {
|
||||
iniset "${tobiko_conf}" keystone username "${ADMIN_USERNAME:-admin}"
|
||||
iniset "${tobiko_conf}" keystone password "${ADMIN_PASSWORD:-secret}"
|
||||
iniset "${tobiko_conf}" keystone project_name "${ADMIN_TENANT_NAME:-admin}"
|
||||
iniset "${tobiko_conf}" keystone user_domain_name "${ADMIN_DOMAIN_NAME:-Default}"
|
||||
iniset "${tobiko_conf}" keystone project_domain_name "${ADMIN_DOMAIN_NAME:-Default}"
|
||||
iniset "${tobiko_conf}" keystone user_domain_name \
|
||||
"${ADMIN_DOMAIN_NAME:-Default}"
|
||||
iniset "${tobiko_conf}" keystone project_domain_name \
|
||||
"${ADMIN_DOMAIN_NAME:-Default}"
|
||||
|
||||
echo_summary "Write compute service options to ${TOBIKO_CONF}"
|
||||
iniset "${tobiko_conf}" compute image_ref "$(get_image_ref)"
|
||||
iniset "${tobiko_conf}" compute flavor_ref "$(get_flavor_ref)"
|
||||
iniset "${tobiko_conf}" nova image "$(get_image)"
|
||||
iniset "${tobiko_conf}" nova flavor "$(get_flavor)"
|
||||
|
||||
echo_summary "Write networking options to ${TOBIKO_CONF}"
|
||||
iniset "${tobiko_conf}" network floating_network_name \
|
||||
"$(get_floating_network_name)"
|
||||
iniset "${tobiko_conf}" neutron floating_network \
|
||||
"$(get_floating_network)"
|
||||
|
||||
echo_summary "Apply changes to ${TOBIKO_CONF} file."
|
||||
sudo mkdir -p $(dirname "${TOBIKO_CONF}")
|
||||
@ -46,7 +48,7 @@ function get_keystone_auth_url {
|
||||
}
|
||||
|
||||
|
||||
function get_image_ref {
|
||||
function get_image {
|
||||
local name=${DEFAULT_IMAGE_NAME:-}
|
||||
if [ "${name}" != "" ]; then
|
||||
openstack image show -f value -c id "${name}"
|
||||
@ -56,7 +58,7 @@ function get_image_ref {
|
||||
}
|
||||
|
||||
|
||||
function get_flavor_ref {
|
||||
function get_flavor {
|
||||
local name=${DEFAULT_INSTANCE_TYPE:-}
|
||||
if [ "${name}" != "" ]; then
|
||||
openstack flavor show -f value -c id "${name}"
|
||||
@ -66,7 +68,7 @@ function get_flavor_ref {
|
||||
}
|
||||
|
||||
|
||||
function get_floating_network_name {
|
||||
function get_floating_network {
|
||||
# the public network (for floating ip access) is only available
|
||||
# if the extension is enabled.
|
||||
# If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created
|
||||
|
@ -15,16 +15,16 @@ from __future__ import absolute_import
|
||||
|
||||
from tobiko import config
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
TEMPLATE_SUFFIX = ".yaml"
|
||||
|
||||
DEFAULT_PARAMS = {
|
||||
'public_net': config.get_any_option(
|
||||
'tobiko.network.floating_network_name',
|
||||
'tempest.network.floating_network_name'),
|
||||
'image': config.get_any_option(
|
||||
'tobiko.compute.image_ref',
|
||||
'tempest.compute.image_ref'),
|
||||
'flavor': config.get_any_option(
|
||||
'tobiko.compute.flavor_ref',
|
||||
'tempest.compute.flavor_ref'),
|
||||
|
||||
# Nova
|
||||
'image': CONF.tobiko.nova.image,
|
||||
'flavor': CONF.tobiko.nova.flavor,
|
||||
|
||||
# Neutron
|
||||
'public_net': CONF.tobiko.neutron.floating_network,
|
||||
}
|
||||
|
@ -24,8 +24,9 @@ import tobiko
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
CONFIG_MODULES = ['tobiko.openstack.config',
|
||||
'tobiko.openstack.keystone.config']
|
||||
CONFIG_MODULES = ['tobiko.openstack.keystone.config',
|
||||
'tobiko.openstack.neutron.config',
|
||||
'tobiko.openstack.nova.config']
|
||||
|
||||
CONFIG_DIRS = [os.getcwd(),
|
||||
os.path.expanduser("~/.tobiko"),
|
||||
@ -87,6 +88,12 @@ def init_tobiko_config(default_config_dirs=None, product_name='tobiko',
|
||||
|
||||
def register_tobiko_options(conf):
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('shell'),
|
||||
opts=[cfg.StrOpt('command',
|
||||
help="Default shell command used for executing "
|
||||
"local commands")])
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('http'),
|
||||
opts=[cfg.StrOpt('http_proxy',
|
||||
@ -97,12 +104,6 @@ def register_tobiko_options(conf):
|
||||
help="Don't use proxy server to connect to listed "
|
||||
"hosts")])
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('tempest'),
|
||||
opts=[cfg.BoolOpt('enabled',
|
||||
default=True,
|
||||
help="Enables tempest integration if available")])
|
||||
|
||||
for module_name in CONFIG_MODULES:
|
||||
module = importlib.import_module(module_name)
|
||||
if hasattr(module, 'register_tobiko_options'):
|
||||
|
@ -1,41 +0,0 @@
|
||||
# Copyright 2018 Red Hat
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
def register_tobiko_options(conf):
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('compute'),
|
||||
opts=[cfg.StrOpt('image_ref',
|
||||
help="Default image reference"),
|
||||
cfg.StrOpt('flavor_ref',
|
||||
help="Default flavor reference")])
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('network'),
|
||||
opts=[cfg.StrOpt('floating_network_name',
|
||||
help="Network name for creating floating IPs")])
|
||||
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('shell'),
|
||||
opts=[cfg.StrOpt('command',
|
||||
help="Default shell command used for executing "
|
||||
"local commands")])
|
||||
|
||||
|
||||
def setup_tobiko_config():
|
||||
pass
|
23
tobiko/openstack/neutron/config.py
Normal file
23
tobiko/openstack/neutron/config.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2019 Red Hat
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
def register_tobiko_options(conf):
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('neutron'),
|
||||
opts=[cfg.StrOpt('floating_network',
|
||||
help="Network for creating floating IPs")])
|
25
tobiko/openstack/nova/config.py
Normal file
25
tobiko/openstack/nova/config.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright 2019 Red Hat
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
def register_tobiko_options(conf):
|
||||
conf.register_opts(
|
||||
group=cfg.OptGroup('nova'),
|
||||
opts=[cfg.StrOpt('image',
|
||||
help="Default image for new server instances"),
|
||||
cfg.StrOpt('flavor',
|
||||
help="Default flavor for new server instances")])
|
Loading…
x
Reference in New Issue
Block a user