Cloudpulse configuration options handler
Implements: blueprint config-handler Change-Id: I726bb4b36775dda1e0773c381e832f28fea89355
This commit is contained in:
parent
787e3f128f
commit
300309fac9
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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
|
||||
@ -13,7 +11,9 @@
|
||||
# under the License.
|
||||
|
||||
import pbr.version
|
||||
import threading
|
||||
|
||||
__version__ = pbr.version.VersionInfo('cloudpulse').version_string()
|
||||
|
||||
__version__ = pbr.version.VersionInfo(
|
||||
'cloudpulse').version_string()
|
||||
# Make a project global TLS trace storage repository
|
||||
TLS = threading.local()
|
||||
|
@ -28,12 +28,12 @@ from cloudpulse.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
trust_opts = [
|
||||
topts = [
|
||||
cfg.ListOpt('trusts_delegated_roles',
|
||||
default=['cloudpulse_assembly_update'],
|
||||
help=_('Subset of roles to be delegated to cloudpulse.')),
|
||||
]
|
||||
cfg.CONF.register_opts(trust_opts)
|
||||
cfg.CONF.register_opts(topts)
|
||||
cfg.CONF.import_opt('auth_uri', 'keystonemiddleware.auth_token',
|
||||
group='keystone_authtoken')
|
||||
|
||||
|
79
cloudpulse/config.py
Normal file
79
cloudpulse/config.py
Normal file
@ -0,0 +1,79 @@
|
||||
# Copyright 2013 - 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.
|
||||
|
||||
"""Cloudpulse specific config handling."""
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from cloudpulse import version
|
||||
|
||||
# Server Specific Configurations
|
||||
server = {
|
||||
'port': '8080',
|
||||
'host': '0.0.0.0'
|
||||
}
|
||||
|
||||
# Pecan Application Configurations
|
||||
app = {'root': 'cloudpulse.api.controllers.root.RootController',
|
||||
'modules': ['cloudpulse.api'],
|
||||
'static_root': '%(confdir)s/public',
|
||||
'template_path': '%(confdir)s/api/templates',
|
||||
'debug': True,
|
||||
'errors': {404: '/error/404',
|
||||
'__force_dict__': True
|
||||
}
|
||||
}
|
||||
|
||||
logging = {
|
||||
'root': {'level': 'INFO', 'handlers': ['console']},
|
||||
'loggers': {
|
||||
'cloudpulse': {'level': 'DEBUG', 'handlers': ['console']},
|
||||
'pecan.commands.serve': {'level': 'DEBUG', 'handlers': ['console']},
|
||||
'py.warnings': {'handlers': ['console']},
|
||||
'__force_dict__': True
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'color'
|
||||
}
|
||||
},
|
||||
'formatters': {
|
||||
'simple': {
|
||||
'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
|
||||
'[%(threadName)s] %(message)s')
|
||||
},
|
||||
'color': {
|
||||
'()': 'pecan.log.ColorFormatter',
|
||||
'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]'
|
||||
'[%(threadName)s] %(message)s'),
|
||||
'__force_dict__': True
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Custom Configurations must be in Python dictionary format::
|
||||
#
|
||||
# foo = {'bar':'baz'}
|
||||
#
|
||||
# All configurations are accessible at::
|
||||
# pecan.conf
|
||||
|
||||
|
||||
def parse_args(argv, default_config_files=None):
|
||||
cfg.CONF(argv[1:],
|
||||
project='cloudpulse',
|
||||
version=version.version_string,
|
||||
default_config_files=default_config_files)
|
@ -22,7 +22,7 @@ import six
|
||||
from cloudpulse.openstack.common._i18n import _, _LE, _LI
|
||||
|
||||
|
||||
periodic_opts = [
|
||||
popts = [
|
||||
cfg.BoolOpt('run_external_periodic_tasks',
|
||||
default=True,
|
||||
help='Some periodic tasks can be run in a separate process. '
|
||||
@ -30,7 +30,7 @@ periodic_opts = [
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(periodic_opts)
|
||||
CONF.register_opts(popts)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -39,7 +39,7 @@ DEFAULT_INTERVAL = 60.0
|
||||
|
||||
def list_opts():
|
||||
"""Entry point for oslo-config-generator."""
|
||||
return [(None, copy.deepcopy(periodic_opts))]
|
||||
return [(None, copy.deepcopy(popts))]
|
||||
|
||||
|
||||
class InvalidPeriodicTaskArg(Exception):
|
||||
|
48
cloudpulse/opts.py
Normal file
48
cloudpulse/opts.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright 2014
|
||||
# The Cloudscaling Group, 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 itertools
|
||||
|
||||
import cloudpulse.api.app
|
||||
import cloudpulse.api.auth
|
||||
import cloudpulse.common.clients
|
||||
import cloudpulse.common.cloudpulse_keystoneclient
|
||||
import cloudpulse.common.exception
|
||||
import cloudpulse.conductor.config
|
||||
import cloudpulse.db.sqlalchemy.models
|
||||
import cloudpulse.openstack.common.eventlet_backdoor
|
||||
import cloudpulse.openstack.common.log
|
||||
import cloudpulse.openstack.common.periodic_task
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
itertools.chain(cloudpulse.api.auth.AUTH_OPTS,
|
||||
cloudpulse.common.cloudpulse_keystoneclient.topts,
|
||||
cloudpulse.common.paths.PATH_OPTS,
|
||||
cloudpulse.common.utils.UTILS_OPTS,
|
||||
(cloudpulse.openstack.common.eventlet_backdoor
|
||||
.eventlet_backdoor_opts),
|
||||
cloudpulse.openstack.common.log.generic_log_opts,
|
||||
cloudpulse.openstack.common.log.log_opts,
|
||||
cloudpulse.openstack.common.log.common_cli_opts,
|
||||
cloudpulse.openstack.common.log.logging_cli_opts,
|
||||
cloudpulse.openstack.common.periodic_task.popts,
|
||||
)),
|
||||
('api', cloudpulse.api.app.API_SERVICE_OPTS),
|
||||
('conductor', cloudpulse.conductor.config.SERVICE_OPTS),
|
||||
('database', cloudpulse.db.sqlalchemy.models.sql_opts),
|
||||
]
|
21
cloudpulse/version.py
Normal file
21
cloudpulse/version.py
Normal file
@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2013 - Noorul Islam K M
|
||||
#
|
||||
# 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 pbr.version
|
||||
|
||||
|
||||
version_info = pbr.version.VersionInfo('cloudpulse')
|
||||
version_string = version_info.version_string
|
Loading…
Reference in New Issue
Block a user