From 15892da8a32e87c8f5e55cc60d7880d9a2aafc2a Mon Sep 17 00:00:00 2001 From: Alvaro Lopez Garcia Date: Thu, 26 Nov 2015 13:50:48 +0100 Subject: [PATCH] generate configuration via oslo add a sample configuration file and a tox environment to generate the configuration files. Change-Id: I96c3955b9e320939a87a6d6def8dc98604405bc3 --- etc/ooi.conf.sample | 15 +++++++++++++++ ooi/opts.py | 21 +++++++++++++++++++++ setup.cfg | 2 ++ tox.ini | 4 ++++ 4 files changed, 42 insertions(+) create mode 100644 etc/ooi.conf.sample create mode 100644 ooi/opts.py diff --git a/etc/ooi.conf.sample b/etc/ooi.conf.sample new file mode 100644 index 0000000..07d426f --- /dev/null +++ b/etc/ooi.conf.sample @@ -0,0 +1,15 @@ +[DEFAULT] + +# +# From ooi +# + +# The IP address on which the OCCI (ooi) API will listen. (string value) +#ooi_listen = 0.0.0.0 + +# The port on which the OCCI (ooi) API will listen. (integer value) +#ooi_listen_port = 8787 + +# Number of workers for OCCI (ooi) API service. The default will be equal to +# the number of CPUs available. (integer value) +#ooi_workers = diff --git a/ooi/opts.py b/ooi/opts.py new file mode 100644 index 0000000..1992575 --- /dev/null +++ b/ooi/opts.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +# Copyright 2015 Spanish National Research Council (CSIC) +# +# 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. + +from ooi import wsgi + + +def list_opts(): + return [("DEFAULT", wsgi.occi_opts)] diff --git a/setup.cfg b/setup.cfg index 8d0aad8..ff6e53c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,6 +47,8 @@ output_file = ooi/locale/ooi.pot [entry_points] paste.filter_factory = ooi = ooi.wsgi:OCCIMiddleware.factory +oslo.config.opts = + ooi = ooi.opts:list_opts [pbr] # Have pbr generate the module indexes like sphinx autodoc diff --git a/tox.ini b/tox.ini index cf0a8dd..19cac91 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,10 @@ deps = coveralls [testenv:docs] commands = python setup.py build_sphinx +[testenv:genconfig] +commands = oslo-config-generator --output-file etc/ooi.conf.sample \ + --namespace ooi --wrap-width 79 + [flake8] # H803 skipped on purpose per list discussion. # E123, E125 skipped as they are invalid PEP-8.