Add `aodh-config-generator' tool to generate sample configuration file

This makes sure our etc/ folder is now empty by default.

Change-Id: I2b9059449ae50b9440f712e064937e2191e25a8f
This commit is contained in:
Julien Danjou 2017-04-25 11:06:48 +02:00
parent 1f50d4b9a8
commit e11d5f0f00
7 changed files with 34 additions and 9 deletions

View File

@ -0,0 +1,28 @@
# -*- encoding: utf-8 -*-
#
# Copyright 2017 Red Hat, Inc.
#
# 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 os
def config_generator():
args = ['--output-file', 'etc/aodh/aodh.conf']
try:
from oslo_config import generator
generator.main(
['--config-file',
'%s/aodh-config-generator.conf' % os.path.dirname(__file__)]
+ args)
except Exception as e:
print("Unable to build sample configuration file: %s" % e)

View File

@ -169,8 +169,6 @@ function configure_aodh {
setup_colorized_logging $AODH_CONF DEFAULT
fi
cp $AODH_DIR/etc/aodh/aodh-config-generator.conf $AODH_CONF_DIR
# The alarm evaluator needs these options to call gnocchi/ceilometer APIs
iniset $AODH_CONF service_credentials auth_type password
iniset $AODH_CONF service_credentials username aodh

View File

@ -51,7 +51,8 @@ extensions = [
'oslo_config.sphinxconfiggen',
]
config_generator_config_file = os.path.join(ROOT, 'etc/aodh/aodh-config-generator.conf')
config_generator_config_file = os.path.join(ROOT,
'aodh/aodh-config-generator.conf')
sample_config_basename = '_static/aodh'
wsme_protocols = ['restjson', 'restxml']

View File

@ -27,8 +27,7 @@ No config file is provided with the source code, it will be created during
the installation. In case where no configuration file was installed, one
can be easily created by running::
oslo-config-generator --config-file=/etc/aodh/aodh-config-generator.conf \
--output-file=/etc/aodh/aodh.conf
aodh-config-generator
The following is a sample Aodh configuration for adaptation and use. It is
auto-generated from Aodh when this documentation is built, and can also be

View File

@ -27,8 +27,6 @@ setup-hooks =
[files]
packages =
aodh
data_files =
etc/aodh = etc/aodh/*
[extras]
mysql =
@ -111,6 +109,7 @@ console_scripts =
aodh-evaluator = aodh.cmd.alarm:evaluator
aodh-notifier = aodh.cmd.alarm:notifier
aodh-listener = aodh.cmd.alarm:listener
aodh-config-generator = aodh.cmd:config_generator
oslo.config.opts =
aodh = aodh.opts:list_opts

View File

@ -22,7 +22,7 @@ deps = .[test,{env:AODH_TEST_DEPS}]
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE AODH_TEST_DRIVERS
commands =
{toxinidir}/run-tests.sh --black-regex '^aodh\.tests\.tempest\..*$' {posargs}
oslo-config-generator --config-file=etc/aodh/aodh-config-generator.conf
aodh-config-generator
[testenv:functional]
deps = .[mysql,postgresql,test]
@ -54,7 +54,7 @@ deps = .[doc]
commands = sphinx-build -a -E -W -d install-guide/build/doctrees -b html install-guide/source install-guide/build/html
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/aodh/aodh-config-generator.conf
commands = aodh-config-generator
[testenv:docs]
deps = .[test,doc]