Tools for generating config file

Add script tool file for generating config file, and remove the old
default config file.

Change-Id: Ibec9d69131d5787bc6f1c04ff84b9ec00c350530
This commit is contained in:
drngsl 2016-10-18 23:05:45 -04:00
parent c9c26cd62d
commit 30d525e4ab
5 changed files with 55 additions and 25 deletions

View File

@ -1,23 +0,0 @@
[DEFAULT]
fuxi_port = 7879
my_ip =
volume_providers = cinder
volume_from = fuxi
default_volume_size = 1
volume_dir = /fuxi/data
threaded = true
debug = False
[keystone]
region =
auth_url =
admin_user =
admin_password =
admin_tenant_name =
admin_token =
auth_insecure = true
[cinder]
volume_connector = osbrick
multiattach = false
fstype = ext4

View File

@ -33,7 +33,6 @@ packages =
fuxi
data_files =
/etc/fuxi =
etc/fuxi.conf
etc/rootwrap.conf
/etc/fuxi/rootwrap.d =
etc/rootwrap.d/fuxi.filters

View File

@ -0,0 +1,54 @@
#!/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
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
DIST_PATH=$(dirname "$SCRIPT_PATH")
prerequisites() (
if ! command -v "$GEN_CMD" > /dev/null; then
echo "ERROR: $GEN_CMD not installed on the system."
return 1
fi
if ! [ -f "${DIST_PATH}/fuxi.egg-info/entry_points.txt" ]; then
curr_dir=$(pwd)
cd "${DIST_PATH}"
python setup.py egg_info # Generate entrypoints for config generation
cd "${curr_dir}"
fi
return 0
)
generate() (
curr_dir=$(pwd)
cd "${DIST_PATH}"
# Set PYTHONPATH so that it will use the generated egg-info
PYTHONPATH=. find "etc/oslo-config-generator" -type f -exec "$GEN_CMD" --config-file="{}" \;
cd "${curr_dir}"
)
prerequisites
rc=$?
if [ $rc -ne 0 ]; then
exit $rc
fi
generate
set -x

View File

@ -37,4 +37,4 @@ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
import_exceptions = fuxi.i18n, fuxi.tests
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/fuxi-config-generator.conf
commands = oslo-config-generator --config-file=etc/oslo-config-generator/fuxi-config-generator.conf