diff --git a/magnum/config.py b/magnum/config.py index a289dae2a5..1b33f63b07 100644 --- a/magnum/config.py +++ b/magnum/config.py @@ -1,54 +1,26 @@ -# Server Specific Configurations -server = { - 'port': '8080', - 'host': '0.0.0.0' -} - -# Pecan Application Configurations -app = { - 'root': 'api.controllers.root.RootController', - 'modules': ['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': { - 'api': {'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:: +# Copyright 2013 - Red Hat, Inc. # -# foo = {'bar':'baz'} +# 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 # -# All configurations are accessible at:: -# pecan.conf +# 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. + +"""Solum specific config handling.""" + +from oslo.config import cfg + +from solum import version + + +def parse_args(argv, default_config_files=None): + cfg.CONF(argv[1:], + project='solum', + version=version.version_string(), + default_config_files=default_config_files) diff --git a/magnum/version.py b/magnum/version.py new file mode 100644 index 0000000000..52705fa39d --- /dev/null +++ b/magnum/version.py @@ -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('solum') +version_string = version_info.version_string diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000000..fa9237ffd1 --- /dev/null +++ b/tox.ini @@ -0,0 +1,37 @@ +[tox] +minversion = 1.6 +envlist = py26,py27,py33,py34,pypy,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = python setup.py testr --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = + flake8 + {toxinidir}/tools/config/check_uptodate.sh + {toxinidir}/tools/check_for_alembic_branches.sh + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = ./coverage.sh {posargs} + +[flake8] +# H803 skipped on purpose per list discussion. +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,H803 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build + +[hacking] +import_exceptions = solum.openstack.common.gettextutils._