Generate plugin config file
Import the framework to generate sample config files using oslo-config-generator so that we can easily maintain consistency between code and the sample file. Note that this effectively removes the override made in the previous sample file. Change-Id: I35352e26f28b0435c05956b0f99c75078d110cbc
This commit is contained in:
parent
749ac4557c
commit
4fd17b7229
3
.gitignore
vendored
3
.gitignore
vendored
@ -56,3 +56,6 @@ ChangeLog
|
||||
|
||||
# Files created by releasenotes build
|
||||
releasenotes/build
|
||||
|
||||
# Generated config files
|
||||
etc/*.sample
|
||||
|
@ -1,4 +1,3 @@
|
||||
# Devstack settings
|
||||
ABSOLUTE_PATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
|
||||
TAAS_PLUGIN_PATH=$ABSOLUTE_PATH/..
|
||||
TAAS_PLUGIN_CONF_FILE="/etc/neutron/taas_plugin.ini"
|
||||
|
5
etc/oslo-config-generator/taas.ini
Normal file
5
etc/oslo-config-generator/taas.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[DEFAULT]
|
||||
output_file = etc/taas.ini.sample
|
||||
wrap_width = 79
|
||||
|
||||
namespace = neutron.taas
|
@ -1,3 +0,0 @@
|
||||
[taas]
|
||||
vlan_range_start = 3000
|
||||
vlan_range_end = 3500
|
@ -28,7 +28,7 @@ taas_quota_opts = [
|
||||
]
|
||||
|
||||
|
||||
TaasOpts = [
|
||||
taas_opts = [
|
||||
cfg.IntOpt(
|
||||
'vlan_range_start',
|
||||
default=3900,
|
||||
@ -42,4 +42,4 @@ TaasOpts = [
|
||||
|
||||
def register():
|
||||
cfg.CONF.register_opts(taas_quota_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(TaasOpts, 'taas')
|
||||
cfg.CONF.register_opts(taas_opts, 'taas')
|
||||
|
27
neutron_taas/opts.py
Normal file
27
neutron_taas/opts.py
Normal file
@ -0,0 +1,27 @@
|
||||
# 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.
|
||||
|
||||
import neutron_taas.common.config
|
||||
import neutron_taas.services.taas.agents.extensions
|
||||
|
||||
|
||||
def list_agent_opts():
|
||||
return [
|
||||
('DEFAULT', neutron_taas.services.taas.agents.extensions.OPTS)
|
||||
]
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('quotas', neutron_taas.common.config.taas_quota_opts),
|
||||
('taas', neutron_taas.common.config.taas_opts)
|
||||
]
|
@ -65,6 +65,9 @@ neutron.service_plugins =
|
||||
taas = neutron_taas.services.taas.taas_plugin:TaasPlugin
|
||||
neutron.db.alembic_migrations =
|
||||
tap-as-a-service = neutron_taas.db.migration:alembic_migration
|
||||
oslo.config.opts =
|
||||
neutron.taas = neutron_taas.opts:list_opts
|
||||
neutron.taas.agent = neutron_taas.opts:list_agent_opts
|
||||
oslo.policy.policies =
|
||||
tap-as-a-service = neutron_taas.policies:list_rules
|
||||
neutron.policies =
|
||||
|
28
tools/generate_config_file_samples.sh
Executable file
28
tools/generate_config_file_samples.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
GEN_CMD=oslo-config-generator
|
||||
|
||||
if ! type "$GEN_CMD" > /dev/null; then
|
||||
echo "ERROR: $GEN_CMD not installed on the system."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in `ls etc/oslo-config-generator/*`; do
|
||||
$GEN_CMD --config-file=$file
|
||||
done
|
||||
|
||||
set -x
|
9
tox.ini
9
tox.ini
@ -19,7 +19,9 @@ commands = find . -type f -name "*.py[c|o]" -delete
|
||||
find . -type l -name "*.py[c|o]" -delete
|
||||
find . -type d -name "__pycache__" -delete
|
||||
stestr run '{posargs}'
|
||||
allowlist_externals = find
|
||||
allowlist_externals =
|
||||
bash
|
||||
find
|
||||
|
||||
[tox:jenkins]
|
||||
sitepackages = True
|
||||
@ -30,7 +32,9 @@ commands =
|
||||
pylint --version
|
||||
pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron_taas}
|
||||
neutron-db-manage --subproject tap-as-a-service --database-connection sqlite:// check_migration
|
||||
{[testenv:genconfig]commands}
|
||||
{[testenv:genpolicy]commands}
|
||||
allowlist_externals = bash
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
@ -97,6 +101,9 @@ extension =
|
||||
[hacking]
|
||||
import_exceptions = neutron_taas._i18n
|
||||
|
||||
[testenv:genconfig]
|
||||
commands = bash {toxinidir}/tools/generate_config_file_samples.sh
|
||||
|
||||
[testenv:dev]
|
||||
# run locally (not in the gate) using editable mode
|
||||
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
|
||||
|
Loading…
Reference in New Issue
Block a user