Browse Source

Make the installation and tox testing work

Work within OpenStack standards.

Co-Authored-By: Digambar Patil <digambarpat@gmail.com>
Co-Authored-By: Steven Dake <sdake@redhat.com>

Change-Id: I805627bd083f33eb14076674d977b235b09dde46
changes/01/133801/3
Steven Dake 4 years ago
parent
commit
b766d59431
3 changed files with 81 additions and 51 deletions
  1. 23
    51
      magnum/config.py
  2. 21
    0
      magnum/version.py
  3. 37
    0
      tox.ini

+ 23
- 51
magnum/config.py View File

@@ -1,54 +1,26 @@
1
-# Server Specific Configurations
2
-server = {
3
-    'port': '8080',
4
-    'host': '0.0.0.0'
5
-}
1
+# Copyright 2013 - Red Hat, Inc.
2
+#
3
+#    Licensed under the Apache License, Version 2.0 (the "License");
4
+#    you may not use this file except in compliance with the License.
5
+#    You may obtain a copy of the License at
6
+#
7
+#        http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+#    Unless required by applicable law or agreed to in writing, software
10
+#    distributed under the License is distributed on an "AS IS" BASIS,
11
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+#    See the License for the specific language governing permissions and
13
+#    limitations under the License.
6 14
 
7
-# Pecan Application Configurations
8
-app = {
9
-    'root': 'api.controllers.root.RootController',
10
-    'modules': ['api'],
11
-    'static_root': '%(confdir)s/public',
12
-    'template_path': '%(confdir)s/api/templates',
13
-    'debug': True,
14
-    'errors': {
15
-        404: '/error/404',
16
-        '__force_dict__': True
17
-    }
18
-}
15
+"""Solum specific config handling."""
19 16
 
20
-logging = {
21
-    'root': {'level': 'INFO', 'handlers': ['console']},
22
-    'loggers': {
23
-        'api': {'level': 'DEBUG', 'handlers': ['console']},
24
-        'pecan.commands.serve': {'level': 'DEBUG', 'handlers': ['console']},
25
-        'py.warnings': {'handlers': ['console']},
26
-        '__force_dict__': True
27
-    },
28
-    'handlers': {
29
-        'console': {
30
-            'level': 'DEBUG',
31
-            'class': 'logging.StreamHandler',
32
-            'formatter': 'color'
33
-        }
34
-    },
35
-    'formatters': {
36
-        'simple': {
37
-            'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
38
-                       '[%(threadName)s] %(message)s')
39
-        },
40
-        'color': {
41
-            '()': 'pecan.log.ColorFormatter',
42
-            'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]'
43
-                       '[%(threadName)s] %(message)s'),
44
-        '__force_dict__': True
45
-        }
46
-    }
47
-}
17
+from oslo.config import cfg
48 18
 
49
-# Custom Configurations must be in Python dictionary format::
50
-#
51
-# foo = {'bar':'baz'}
52
-#
53
-# All configurations are accessible at::
54
-# pecan.conf
19
+from solum import version
20
+
21
+
22
+def parse_args(argv, default_config_files=None):
23
+    cfg.CONF(argv[1:],
24
+             project='solum',
25
+             version=version.version_string(),
26
+             default_config_files=default_config_files)

+ 21
- 0
magnum/version.py View File

@@ -0,0 +1,21 @@
1
+# -*- coding: utf-8 -*-
2
+#
3
+# Copyright 2013 - Noorul Islam K M
4
+#
5
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
+# not use this file except in compliance with the License. You may obtain
7
+# a copy of the License at
8
+#
9
+#      http://www.apache.org/licenses/LICENSE-2.0
10
+#
11
+# Unless required by applicable law or agreed to in writing, software
12
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+# License for the specific language governing permissions and limitations
15
+# under the License.
16
+
17
+import pbr.version
18
+
19
+
20
+version_info = pbr.version.VersionInfo('solum')
21
+version_string = version_info.version_string

+ 37
- 0
tox.ini View File

@@ -0,0 +1,37 @@
1
+[tox]
2
+minversion = 1.6
3
+envlist = py26,py27,py33,py34,pypy,pep8
4
+skipsdist = True
5
+
6
+[testenv]
7
+usedevelop = True
8
+install_command = pip install -U {opts} {packages}
9
+setenv =
10
+   VIRTUAL_ENV={envdir}
11
+deps = -r{toxinidir}/requirements.txt
12
+       -r{toxinidir}/test-requirements.txt
13
+commands = python setup.py testr --slowest --testr-args='{posargs}'
14
+
15
+[testenv:pep8]
16
+commands =
17
+  flake8
18
+  {toxinidir}/tools/config/check_uptodate.sh
19
+  {toxinidir}/tools/check_for_alembic_branches.sh
20
+
21
+[testenv:venv]
22
+commands = {posargs}
23
+
24
+[testenv:cover]
25
+commands = ./coverage.sh {posargs}
26
+
27
+[flake8]
28
+# H803 skipped on purpose per list discussion.
29
+# E123, E125 skipped as they are invalid PEP-8.
30
+
31
+show-source = True
32
+ignore = E123,E125,H803
33
+builtins = _
34
+exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
35
+
36
+[hacking]
37
+import_exceptions = solum.openstack.common.gettextutils._

Loading…
Cancel
Save