Added ability to generate config file

To generate use tox -e genconfig

Change-Id: Ie2065f822991bf308805de7788712cdc7b31d1dc
This commit is contained in:
Ade Lee 2017-01-04 12:12:57 -05:00
parent aaf832f0ab
commit b0c0bf145a
6 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,8 @@
[DEFAULT]
output_file = files/join.conf.sample
wrap_width = 79
namespace = novajoin
namespace = novajoin-auth
namespace = oslo.log

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import itertools
import os
from oslo_config import cfg
@ -105,3 +106,12 @@ def find_config_files():
CONF = cfg.CONF
CONF.register_opts(service_opts)
log.register_options(CONF)
def list_opts():
return [
('DEFAULT',
itertools.chain(
service_opts,
)),
]

View File

@ -63,6 +63,12 @@ def register_keystoneauth_opts(conf):
})
def list_keystoneauth_opts():
return [('service_credentials', (
ks_loading.get_auth_common_conf_options() +
ks_loading.get_auth_plugin_conf_options('password')))]
def get_project_name(project_id):
"""Given a keystone project-id return the name of the project."""
# Handle case where no credentials are configured

View File

@ -0,0 +1,48 @@
# Copyright 2016 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.
from oslo_middleware import cors
def set_config_defaults():
"""This method updates all configuration default values."""
set_cors_middleware_defaults()
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['Content-MD5',
'X-Image-Meta-Checksum',
'X-Storage-Token',
'Accept-Encoding',
'X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-OpenStack-Request-ID'],
expose_headers=['X-Image-Meta-Checksum',
'X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-OpenStack-Request-ID'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH']
)

View File

@ -57,3 +57,12 @@ universal = 1
[pbr]
skip_authors = True
skip_changelog = True
[entry_points]
oslo.config.opts =
novajoin = novajoin.config:list_opts
novajoin-auth = novajoin.keystone_client:list_keystoneauth_opts
oslo.config.opts.defaults =
novajoin = novajoin.middleware.config:set_config_defaults

View File

@ -60,3 +60,9 @@ commands = {posargs}
[testenv:docs]
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:genconfig]
sitepackages = False
envdir = {toxworkdir}/pep8
commands = oslo-config-generator --config-file=files/novajoin-config-generator.conf