Automatically generate neutron FWaaS configuration files

This adds a new tox environment, genconfig, which generates sample
neutron FWaaS configuration file using oslo-config-generator.

Partially-Implements: blueprint autogen-neutron-conf-file

Change-Id: I8e9113dfb88e5290f6eedd012d1a52fc35c3c88c
Partial-bug: #1199963
This commit is contained in:
Martin Hickey 2015-12-01 16:58:50 +00:00
parent b328b91c50
commit 93883c17db
8 changed files with 76 additions and 0 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ cover/
covhtml/
dist/
doc/build
etc/*.sample
*.DS_Store
*.pyc
neutron.egg-info/

9
etc/README.txt Normal file
View File

@ -0,0 +1,9 @@
To generate the sample neutron-fwaas configuration files, run the following
command from the top level of the neutron-fwaas directory:
tox -e genconfig
If a 'tox' environment is unavailable, then you can run the following script
instead to generate the configuration files:
./tools/generate_config_file_samples.sh

View File

@ -0,0 +1,5 @@
[DEFAULT]
output_file = etc/fwaas_driver.ini.sample
wrap_width = 79
namespace = firewall.agent

20
neutron_fwaas/opts.py Normal file
View File

@ -0,0 +1,20 @@
# 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_fwaas.services.firewall.agents.firewall_agent_api
def list_agent_opts():
return [
('fwaas',
neutron_fwaas.services.firewall.agents.firewall_agent_api.FWaaSOpts)
]

View File

@ -0,0 +1,7 @@
---
prelude: >
Generation of sample Neutron FWaaS configuration files.
features:
- Neutron FWaaS no longer includes static example configuration files.
Instead, use tools/generate_config_file_samples.sh to generate them.
The files are generated with a .sample extension.

View File

@ -36,6 +36,8 @@ neutron.db.alembic_migrations =
neutron-fwaas = neutron_fwaas.db.migration:alembic_migrations
tempest.test_plugins =
neutron-fwaas = neutron_fwaas.tests.tempest_plugin.plugin:NeutronFWaaSPlugin
oslo.config.opts =
firewall.agent = neutron_fwaas.opts:list_agent_opts
[build_sphinx]
all_files = 1

View 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

View File

@ -41,6 +41,7 @@ commands =
flake8
{toxinidir}/tools/check_unit_test_structure.sh
neutron-db-manage --subproject neutron-fwaas --database-connection sqlite:// check_migration
{[testenv:genconfig]commands}
whitelist_externals = sh
[testenv:i18n]
@ -80,3 +81,6 @@ commands =
[hacking]
import_exceptions = neutron.i18n
local-check-factory = neutron.hacking.checks.factory
[testenv:genconfig]
commands = {toxinidir}/tools/generate_config_file_samples.sh