Use oslo.config generator

Replace usage of old incubator configuration generator by the
oslo.config tool.

tools/config/generate_sample.sh has been replaced by tox -egenconfig.

heat_integrationtests/generate_sample.sh has been replaced by
oslo-config-generator
--config-file=heat_integrationtests/config-generator.conf

Change-Id: I6d95df203b556c8ec2088d40a446427f7087b9a7
This commit is contained in:
Thomas Herve 2014-12-17 10:36:51 +01:00
parent e930bc2887
commit ec6ff6f670
19 changed files with 108 additions and 617 deletions

18
config-generator.conf Normal file
View File

@ -0,0 +1,18 @@
[DEFAULT]
output_file = etc/heat/heat.conf.sample
wrap_width = 79
namespace = heat.common.config
namespace = heat.common.crypt
namespace = heat.common.heat_keystoneclient
namespace = heat.common.wsgi
namespace = heat.engine.clients
namespace = heat.engine.notification
namespace = heat.engine.resources
namespace = heat.openstack.common.eventlet_backdoor
namespace = heat.openstack.common.log
namespace = heat.openstack.common.policy
namespace = heat.api.middleware.ssl
namespace = heat.api.aws.ec2token
namespace = keystonemiddleware.auth_token
namespace = oslo.messaging
namespace = oslo.db

View File

@ -235,3 +235,7 @@ def EC2Token_filter_factory(global_conf, **local_conf):
return EC2Token(app, conf)
return filter
def list_opts():
yield 'ec2authtoken', opts

View File

@ -39,3 +39,7 @@ class SSLMiddleware(wsgi.Middleware):
def process_request(self, req):
req.environ['wsgi.url_scheme'] = req.environ.get(
self.secure_proxy_ssl_header, req.environ['wsgi.url_scheme'])
def list_opts():
yield None, ssl_middleware_opts

View File

@ -61,3 +61,7 @@ def heat_decrypt(auth_info):
cipher = AES.new(cfg.CONF.auth_encryption_key[:32], AES.MODE_CFB, iv)
res = cipher.decrypt(auth[AES.block_size:])
return res
def list_opts():
yield None, auth_opts

View File

@ -688,3 +688,7 @@ class KeystoneClient(object):
cfg.CONF.keystone_backend,
context
)
def list_opts():
yield None, keystone_opts

View File

@ -157,3 +157,7 @@ def initialise():
namespace='heat.clients',
invoke_on_load=False,
verify_requirements=True)
def list_opts():
yield None, cloud_opts

View File

@ -48,3 +48,7 @@ def notify(context, event_type, level, body):
method = getattr(client, level.lower())
method(context, "%s.%s" % (SERVICE, event_type), body)
def list_opts():
yield None, notifier_opts

View File

@ -86,3 +86,8 @@ def _load_global_resources(env):
_register_resources(env, resource_mapping.load_all(manager))
_register_constraints(env, constraint_mapping.load_all(manager))
def list_opts():
from heat.engine.resources import loadbalancer
yield None, loadbalancer.loadbalancer_opts

View File

@ -1,311 +0,0 @@
# Copyright 2012 SINA Corporation
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# 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.
#
"""Extracts OpenStack config option info from module(s)."""
from __future__ import print_function
import argparse
import imp
import os
import re
import socket
import sys
import textwrap
from oslo.config import cfg
import six
import stevedore.named
from heat.common import i18n
from heat.openstack.common import importutils
STROPT = "StrOpt"
BOOLOPT = "BoolOpt"
INTOPT = "IntOpt"
FLOATOPT = "FloatOpt"
LISTOPT = "ListOpt"
DICTOPT = "DictOpt"
MULTISTROPT = "MultiStrOpt"
OPT_TYPES = {
STROPT: 'string value',
BOOLOPT: 'boolean value',
INTOPT: 'integer value',
FLOATOPT: 'floating point value',
LISTOPT: 'list value',
DICTOPT: 'dict value',
MULTISTROPT: 'multi valued',
}
OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT,
FLOATOPT, LISTOPT, DICTOPT,
MULTISTROPT]))
PY_EXT = ".py"
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
"../../../../"))
WORDWRAP_WIDTH = 60
def raise_extension_exception(extmanager, ep, err):
raise
def generate(argv):
parser = argparse.ArgumentParser(
description='generate sample configuration file',
)
parser.add_argument('-m', dest='modules', action='append')
parser.add_argument('-l', dest='libraries', action='append')
parser.add_argument('srcfiles', nargs='*')
parsed_args = parser.parse_args(argv)
mods_by_pkg = dict()
for filepath in parsed_args.srcfiles:
pkg_name = filepath.split(os.sep)[1]
mod_str = '.'.join(['.'.join(filepath.split(os.sep)[:-1]),
os.path.basename(filepath).split('.')[0]])
mods_by_pkg.setdefault(pkg_name, list()).append(mod_str)
# NOTE(lzyeval): place top level modules before packages
pkg_names = sorted(pkg for pkg in mods_by_pkg if pkg.endswith(PY_EXT))
ext_names = sorted(pkg for pkg in mods_by_pkg if pkg not in pkg_names)
pkg_names.extend(ext_names)
# opts_by_group is a mapping of group name to an options list
# The options list is a list of (module, options) tuples
opts_by_group = {'DEFAULT': []}
if parsed_args.modules:
for module_name in parsed_args.modules:
module = _import_module(module_name)
if module:
for group, opts in _list_opts(module):
opts_by_group.setdefault(group, []).append((module_name,
opts))
# Look for entry points defined in libraries (or applications) for
# option discovery, and include their return values in the output.
#
# Each entry point should be a function returning an iterable
# of pairs with the group name (or None for the default group)
# and the list of Opt instances for that group.
if parsed_args.libraries:
loader = stevedore.named.NamedExtensionManager(
'oslo.config.opts',
names=list(set(parsed_args.libraries)),
invoke_on_load=False,
on_load_failure_callback=raise_extension_exception
)
for ext in loader:
for group, opts in ext.plugin():
opt_list = opts_by_group.setdefault(group or 'DEFAULT', [])
opt_list.append((ext.name, opts))
for pkg_name in pkg_names:
mods = mods_by_pkg.get(pkg_name)
mods.sort()
for mod_str in mods:
if mod_str.endswith('.__init__'):
mod_str = mod_str[:mod_str.rfind(".")]
mod_obj = _import_module(mod_str)
if not mod_obj:
raise RuntimeError("Unable to import module %s" % mod_str)
for group, opts in _list_opts(mod_obj):
opts_by_group.setdefault(group, []).append((mod_str, opts))
print_group_opts('DEFAULT', opts_by_group.pop('DEFAULT', []))
for group in sorted(opts_by_group.keys()):
print_group_opts(group, opts_by_group[group])
def _import_module(mod_str):
try:
if mod_str.startswith('bin.'):
imp.load_source(mod_str[4:], os.path.join('bin', mod_str[4:]))
return sys.modules[mod_str[4:]]
else:
return importutils.import_module(mod_str)
except Exception as e:
sys.stderr.write("Error importing module %s: %s\n" % (mod_str, str(e)))
return None
def _is_in_group(opt, group):
"""Check if opt is in group."""
for value in group._opts.values():
# NOTE(llu): Temporary workaround for bug #1262148, wait until
# newly released oslo.config support '==' operator.
if not(value['opt'] != opt):
return True
return False
def _guess_groups(opt):
# is it in the DEFAULT group?
if _is_in_group(opt, cfg.CONF):
return 'DEFAULT'
# what other groups is it in?
for value in cfg.CONF.values():
if isinstance(value, cfg.CONF.GroupAttr):
if _is_in_group(opt, value._group):
return value._group.name
raise RuntimeError(
"Unable to find group for option %s, "
"maybe it's defined twice in the same group?"
% opt.name
)
def _list_opts(obj):
def is_opt(o):
return (isinstance(o, cfg.Opt) and
not isinstance(o, cfg.SubCommandOpt))
opts = list()
for attr_str in dir(obj):
attr_obj = getattr(obj, attr_str)
if is_opt(attr_obj):
opts.append(attr_obj)
elif (isinstance(attr_obj, list) and
all(map(lambda x: is_opt(x), attr_obj))):
opts.extend(attr_obj)
ret = {}
for opt in opts:
ret.setdefault(_guess_groups(opt), []).append(opt)
return ret.items()
def print_group_opts(group, opts_by_module):
print("[%s]" % group)
print('')
for mod, opts in opts_by_module:
print('#')
print('# Options defined in %s' % mod)
print('#')
print('')
for opt in opts:
_print_opt(opt)
print('')
def _get_my_ip():
try:
csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
csock.connect(('8.8.8.8', 80))
(addr, port) = csock.getsockname()
csock.close()
return addr
except socket.error:
return None
def _sanitize_default(name, value):
"""Set up a reasonably sensible default for pybasedir, my_ip and host."""
hostname = socket.gethostname()
fqdn = socket.getfqdn()
if value.startswith(sys.prefix):
# NOTE(jd) Don't use os.path.join, because it is likely to think the
# second part is an absolute pathname and therefore drop the first
# part.
value = os.path.normpath("/usr/" + value[len(sys.prefix):])
elif value.startswith(BASEDIR):
return value.replace(BASEDIR, '/usr/lib/python/site-packages')
elif BASEDIR in value:
return value.replace(BASEDIR, '')
elif value == _get_my_ip():
return '10.0.0.1'
elif value in (hostname, fqdn):
if 'host' in name:
return 'heat'
elif value.endswith(hostname):
return value.replace(hostname, 'heat')
elif value.endswith(fqdn):
return value.replace(fqdn, 'heat')
elif value.strip() != value:
return '"%s"' % value
return value
def _print_opt(opt):
opt_name, opt_default, opt_help = opt.dest, opt.default, opt.help
if not opt_help:
sys.stderr.write('WARNING: "%s" is missing help string.\n' % opt_name)
opt_help = ""
try:
opt_type = OPTION_REGEX.search(str(type(opt))).group(0)
except (ValueError, AttributeError) as err:
sys.stderr.write("%s\n" % str(err))
sys.exit(1)
opt_help = u'%s (%s)' % (opt_help,
OPT_TYPES[opt_type])
print('#', "\n# ".join(textwrap.wrap(opt_help, WORDWRAP_WIDTH)))
if opt.deprecated_opts:
for deprecated_opt in opt.deprecated_opts:
if deprecated_opt.name:
deprecated_group = (deprecated_opt.group if
deprecated_opt.group else "DEFAULT")
print('# Deprecated group/name - [%s]/%s' %
(deprecated_group,
deprecated_opt.name))
try:
if opt_default is None:
print('#%s=<None>' % opt_name)
elif opt_type == STROPT:
assert(isinstance(opt_default, six.string_types))
print('#%s=%s' % (opt_name, _sanitize_default(opt_name,
opt_default)))
elif opt_type == BOOLOPT:
assert(isinstance(opt_default, bool))
print('#%s=%s' % (opt_name, str(opt_default).lower()))
elif opt_type == INTOPT:
assert(isinstance(opt_default, int) and
not isinstance(opt_default, bool))
print('#%s=%s' % (opt_name, opt_default))
elif opt_type == FLOATOPT:
assert(isinstance(opt_default, float))
print('#%s=%s' % (opt_name, opt_default))
elif opt_type == LISTOPT:
assert(isinstance(opt_default, list))
print('#%s=%s' % (opt_name, ','.join(opt_default)))
elif opt_type == DICTOPT:
assert(isinstance(opt_default, dict))
opt_default_strlist = [str(key) + ':' + str(value)
for (key, value) in opt_default.items()]
print('#%s=%s' % (opt_name, ','.join(opt_default_strlist)))
elif opt_type == MULTISTROPT:
assert(isinstance(opt_default, list))
if not opt_default:
opt_default = ['']
for default in opt_default:
print('#%s=%s' % (opt_name, default))
print('')
except Exception:
sys.stderr.write('Error in option "%s"\n' % opt_name)
sys.exit(1)
def main():
generate(sys.argv[1:])
if __name__ == '__main__':
main()

View File

@ -1,73 +0,0 @@
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# 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 related utilities and helper functions.
"""
import sys
import traceback
def import_class(import_str):
"""Returns a class from a string including module and class."""
mod_str, _sep, class_str = import_str.rpartition('.')
__import__(mod_str)
try:
return getattr(sys.modules[mod_str], class_str)
except AttributeError:
raise ImportError('Class %s cannot be found (%s)' %
(class_str,
traceback.format_exception(*sys.exc_info())))
def import_object(import_str, *args, **kwargs):
"""Import a class and return an instance of it."""
return import_class(import_str)(*args, **kwargs)
def import_object_ns(name_space, import_str, *args, **kwargs):
"""Tries to import object from default namespace.
Imports a class and return an instance of it, first by trying
to find the class in a default namespace, then failing back to
a full path if not found in the default namespace.
"""
import_value = "%s.%s" % (name_space, import_str)
try:
return import_class(import_value)(*args, **kwargs)
except ImportError:
return import_class(import_str)(*args, **kwargs)
def import_module(import_str):
"""Import a module."""
__import__(import_str)
return sys.modules[import_str]
def import_versioned_module(version, submodule=None):
module = 'heat.v%s' % version
if submodule:
module = '.'.join((module, submodule))
return import_module(module)
def try_import(import_str, default=None):
"""Try to import a module and if it fails return default."""
try:
return import_module(import_str)
except ImportError:
return default

View File

@ -11,7 +11,6 @@
# under the License.
import os
import sys
from oslo.config import cfg
@ -108,7 +107,5 @@ def init_conf(read_conf=True):
return conf
if __name__ == '__main__':
cfg.CONF = init_conf(False)
import heat.openstack.common.config.generator as generate
generate.generate(sys.argv[1:])
def list_opts():
yield None, IntegrationTestGroup

View File

@ -1,27 +0,0 @@
#!/bin/bash
#
# 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.
# generates sample configuration file heat_integrationtests.conf.sample
unset OS_USERNAME
unset OS_PASSWORD
unset OS_TENANT_NAME
unset OS_AUTH_URL
unset OS_REGION_NAME
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $DIR/..
PYTHONPATH=. python -m heat_integrationtests.common.config \
heat_integrationtests/common/config.py \
> heat_integrationtests/heat_integrationtests.conf.sample
popd

View File

@ -1,78 +1,68 @@
[DEFAULT]
#
# Options defined in heat_integrationtests.common.config
# From heat_integrationtests.common.config
#
# Username to use for API requests. (string value)
#username=<None>
# Full URI of the OpenStack Identity API (Keystone), v2 (string value)
#auth_url = <None>
# API key to use when authenticating. (string value)
#password=<None>
# Tenant name to use for API requests. (string value)
#tenant_name=<None>
# Full URI of the OpenStack Identity API (Keystone), v2
# (string value)
#auth_url=<None>
# The region name to us (string value)
#region=<None>
# Instance type for tests. Needs to be big enough for a full
# OS plus the test workload (string value)
#instance_type=m1.micro
# Name of image to use for tests which boot servers. (string
# Identity API version to be used for authentication for API tests. (string
# value)
#image_ref=Fedora-x86_64-20-20140618-sda
# Name of existing keypair to launch servers with. (string
# value)
#keypair_name=<None>
# Name of minimal (e.g cirros) image to use when launching
# test instances. (string value)
#minimal_image_ref=cirros-0.3.2-x86_64-uec
# Identity API version to be used for authentication for API
# tests. (string value)
#auth_version=v2
# Set to True if using self-signed SSL certificates. (boolean
# value)
#disable_ssl_certificate_validation=false
#auth_version = v2
# Time in seconds between build status checks. (integer value)
#build_interval=4
#build_interval = 4
# Timeout in seconds to wait for a stack to build. (integer
# value)
#build_timeout=1200
# Timeout in seconds to wait for a stack to build. (integer value)
#build_timeout = 1200
# Network used for SSH connections. (string value)
#network_for_ssh=private
# Set to True if using self-signed SSL certificates. (boolean value)
#disable_ssl_certificate_validation = false
# Visible fixed network name (string value)
#fixed_network_name=private
#fixed_network_name = private
# Timeout in seconds to wait for authentication to succeed.
# (integer value)
#ssh_timeout=300
# Name of image to use for tests which boot servers. (string value)
#image_ref = <None>
# Instance type for tests. Needs to be big enough for a full OS plus the test
# workload (string value)
#instance_type = <None>
# IP version used for SSH connections. (integer value)
#ip_version_for_ssh=4
#ip_version_for_ssh = 4
# Timeout in seconds to wait for output from ssh channel.
# (integer value)
#ssh_channel_timeout=60
# Name of existing keypair to launch servers with. (string value)
#keypair_name = <None>
# Name of minimal (e.g cirros) image to use when launching test instances.
# (string value)
#minimal_image_ref = <None>
# Network used for SSH connections. (string value)
#network_for_ssh = private
# API key to use when authenticating. (string value)
#password = <None>
# The region name to us (string value)
#region = <None>
# Timeout in seconds to wait for output from ssh channel. (integer value)
#ssh_channel_timeout = 60
# Timeout in seconds to wait for authentication to succeed. (integer value)
#ssh_timeout = 300
# Tenant name to use for API requests. (string value)
#tenant_name = <None>
# The mask bits for tenant ipv4 subnets (integer value)
#tenant_network_mask_bits=28
# Default size in GB for volumes created by volumes tests
# (integer value)
#volume_size=1
#tenant_network_mask_bits = 28
# Username to use for API requests. (string value)
#username = <None>
# Default size in GB for volumes created by volumes tests (integer value)
#volume_size = 1

View File

@ -1,7 +1,6 @@
[DEFAULT]
# The list of modules to copy from oslo-incubator
module=config
module=crypto
module=eventlet_backdoor
module=local

View File

@ -33,7 +33,18 @@ scripts =
[entry_points]
oslo.config.opts =
heat.common.config = heat.common.config:list_opts
heat.common.crypt = heat.common.crypt:list_opts
heat.common.heat_keystoneclient = heat.common.heat_keystoneclient:list_opts
heat.common.wsgi = heat.common.wsgi:list_opts
heat.engine.clients = heat.engine.clients:list_opts
heat.engine.notification = heat.engine.notification:list_opts
heat.engine.resources = heat.engine.resources:list_opts
heat.openstack.common.eventlet_backdoor = heat.openstack.common.eventlet_backdoor:list_opts
heat.openstack.common.log = heat.openstack.common.log:list_opts
heat.openstack.common.policy = heat.openstack.common.policy:list_opts
heat.api.middleware.ssl = heat.api.middleware.ssl:list_opts
heat.api.aws.ec2token = heat.api.aws.ec2token:list_opts
heat_integrationtests.common.config = heat_integrationtests.common.config:list_opts
heat.clients =
ceilometer = heat.engine.clients.os.ceilometer:CeilometerClientPlugin

View File

@ -1,138 +0,0 @@
#!/usr/bin/env bash
# Generate sample configuration for your project.
#
# Aside from the command line flags, it also respects a config file which
# should be named oslo.config.generator.rc and be placed in the same directory.
#
# You can then export the following variables:
# HEAT_CONFIG_GENERATOR_EXTRA_MODULES: list of modules to interrogate for options.
# HEAT_CONFIG_GENERATOR_EXTRA_LIBRARIES: list of libraries to discover.
# HEAT_CONFIG_GENERATOR_EXCLUDED_FILES: list of files to remove from automatic listing.
print_hint() {
echo "Try \`${0##*/} --help' for more information." >&2
}
PARSED_OPTIONS=$(getopt -n "${0##*/}" -o hb:p:m:l:o: \
--long help,base-dir:,package-name:,output-dir:,module:,library: -- "$@")
if [ $? != 0 ] ; then print_hint ; exit 1 ; fi
eval set -- "$PARSED_OPTIONS"
while true; do
case "$1" in
-h|--help)
echo "${0##*/} [options]"
echo ""
echo "options:"
echo "-h, --help show brief help"
echo "-b, --base-dir=DIR project base directory"
echo "-p, --package-name=NAME project package name"
echo "-o, --output-dir=DIR file output directory"
echo "-m, --module=MOD extra python module to interrogate for options"
echo "-l, --library=LIB extra library that registers options for discovery"
exit 0
;;
-b|--base-dir)
shift
BASEDIR=`echo $1 | sed -e 's/\/*$//g'`
shift
;;
-p|--package-name)
shift
PACKAGENAME=`echo $1`
shift
;;
-o|--output-dir)
shift
OUTPUTDIR=`echo $1 | sed -e 's/\/*$//g'`
shift
;;
-m|--module)
shift
MODULES="$MODULES -m $1"
shift
;;
-l|--library)
shift
LIBRARIES="$LIBRARIES -l $1"
shift
;;
--)
break
;;
esac
done
BASEDIR=${BASEDIR:-`pwd`}
if ! [ -d $BASEDIR ]
then
echo "${0##*/}: missing project base directory" >&2 ; print_hint ; exit 1
elif [[ $BASEDIR != /* ]]
then
BASEDIR=$(cd "$BASEDIR" && pwd)
fi
PACKAGENAME=${PACKAGENAME:-$(python setup.py --name)}
TARGETDIR=$BASEDIR/$PACKAGENAME
if ! [ -d $TARGETDIR ]
then
echo "${0##*/}: invalid project package name" >&2 ; print_hint ; exit 1
fi
OUTPUTDIR=${OUTPUTDIR:-$BASEDIR/etc}
# NOTE(bnemec): Some projects put their sample config in etc/,
# some in etc/$PACKAGENAME/
if [ -d $OUTPUTDIR/$PACKAGENAME ]
then
OUTPUTDIR=$OUTPUTDIR/$PACKAGENAME
elif ! [ -d $OUTPUTDIR ]
then
echo "${0##*/}: cannot access \`$OUTPUTDIR': No such file or directory" >&2
exit 1
fi
BASEDIRESC=`echo $BASEDIR | sed -e 's/\//\\\\\//g'`
find $TARGETDIR -type f -name "*.pyc" -delete
FILES=$(find $TARGETDIR -type f -name "*.py" ! -path "*/tests/*" \
-exec grep -l "Opt(" {} + | sed -e "s/^$BASEDIRESC\///g" | sort -u)
RC_FILE="`dirname $0`/oslo.config.generator.rc"
if test -r "$RC_FILE"
then
source "$RC_FILE"
fi
for filename in ${HEAT_CONFIG_GENERATOR_EXCLUDED_FILES}; do
FILES="${FILES[@]/$filename/}"
done
for mod in ${HEAT_CONFIG_GENERATOR_EXTRA_MODULES}; do
MODULES="$MODULES -m $mod"
done
for lib in ${HEAT_CONFIG_GENERATOR_EXTRA_LIBRARIES}; do
LIBRARIES="$LIBRARIES -l $lib"
done
export EVENTLET_NO_GREENDNS=yes
OS_VARS=$(set | sed -n '/^OS_/s/=[^=]*$//gp' | xargs)
[ "$OS_VARS" ] && eval "unset \$OS_VARS"
DEFAULT_MODULEPATH=heat.openstack.common.config.generator
MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH}
OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample
python -m $MODULEPATH $MODULES $LIBRARIES $FILES > $OUTPUTFILE
if [ $? != 0 ]
then
echo "Can not generate $OUTPUTFILE"
exit 1
fi
# Hook to allow projects to append custom config file snippets
CONCAT_FILES=$(ls $BASEDIR/tools/config/*.conf.sample 2>/dev/null)
for CONCAT_FILE in $CONCAT_FILES; do
cat $CONCAT_FILE >> $OUTPUTFILE
done

View File

@ -1,3 +0,0 @@
export HEAT_CONFIG_GENERATOR_EXTRA_MODULES=keystonemiddleware.auth_token
export HEAT_CONFIG_GENERATOR_EXTRA_LIBRARIES="heat.common.config heat.common.wsgi oslo.messaging oslo.db"
export HEAT_CONFIG_GENERATOR_EXCLUDED_FILES="heat/common/config.py heat/common/wsgi.py"

View File

@ -49,8 +49,7 @@ deps = -r{toxinidir}/requirements.txt
commands = python setup.py build_sphinx
[testenv:genconfig]
commands =
bash tools/config/generate_sample.sh -b . -p heat -o etc/heat
commands = oslo-config-generator --config-file=config-generator.conf
[flake8]
# H404 multi line docstring should start with a summary