Merge with code generated using OpenStack cookie-cutter
Adjust imports, requirements etc to get py27 and pep8 working Co-Authored-By: Digambar Patil <digambarpat@gmail.com> Co-Authored-By: Steven Dake <sdake@redhat.com> Change-Id: I23f9afc2b3039f03f9db58bc502f348c4943fdf0
This commit is contained in:
parent
cf20cacf75
commit
d23b325704
|
@ -0,0 +1,7 @@
|
||||||
|
[run]
|
||||||
|
branch = True
|
||||||
|
source = magnum
|
||||||
|
omit = magnum/tests/*,magnum/openstack/*
|
||||||
|
|
||||||
|
[report]
|
||||||
|
ignore-errors = True
|
|
@ -1,38 +1,32 @@
|
||||||
# Byte-compiled / optimized / DLL files
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
# Distribution / packaging
|
# Packages
|
||||||
.Python
|
|
||||||
env/
|
|
||||||
bin/
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
eggs
|
||||||
|
parts
|
||||||
|
bin
|
||||||
|
var
|
||||||
|
sdist
|
||||||
|
develop-eggs
|
||||||
|
.installed.cfg
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Unit test / coverage reports
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.coverage
|
.coverage
|
||||||
.cache
|
.tox
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
.testrepository
|
||||||
|
.venv
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
@ -42,13 +36,18 @@ coverage.xml
|
||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
|
|
||||||
# Rope
|
# Complexity
|
||||||
.ropeproject
|
output/*.html
|
||||||
|
output/*/index.html
|
||||||
|
|
||||||
# Django stuff:
|
# Sphinx
|
||||||
*.log
|
doc/build
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Sphinx documentation
|
# pbr generates these
|
||||||
docs/_build/
|
AUTHORS
|
||||||
|
ChangeLog
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
*~
|
||||||
|
.*.swp
|
||||||
|
.*sw?
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Format is:
|
||||||
|
# <preferred e-mail> <other e-mail 1>
|
||||||
|
# <preferred e-mail> <other e-mail 2>
|
|
@ -0,0 +1,7 @@
|
||||||
|
[DEFAULT]
|
||||||
|
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||||
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||||
|
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
|
||||||
|
test_id_option=--load-list $IDFILE
|
||||||
|
test_list_option=--list
|
|
@ -0,0 +1,17 @@
|
||||||
|
If you would like to contribute to the development of OpenStack,
|
||||||
|
you must follow the steps in the "If you're a developer, start here"
|
||||||
|
section of this page:
|
||||||
|
|
||||||
|
http://wiki.openstack.org/HowToContribute
|
||||||
|
|
||||||
|
Once those steps have been completed, changes to OpenStack
|
||||||
|
should be submitted for review via the Gerrit tool, following
|
||||||
|
the workflow documented at:
|
||||||
|
|
||||||
|
http://wiki.openstack.org/GerritWorkflow
|
||||||
|
|
||||||
|
Pull requests submitted through GitHub will be ignored.
|
||||||
|
|
||||||
|
Bugs should be filed on Launchpad, not GitHub:
|
||||||
|
|
||||||
|
https://bugs.launchpad.net/magnum
|
|
@ -0,0 +1,4 @@
|
||||||
|
magnum Style Commandments
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
1
LICENSE
1
LICENSE
|
@ -173,3 +173,4 @@
|
||||||
defend, and hold each Contributor harmless for any liability
|
defend, and hold each Contributor harmless for any liability
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
of your accepting any such warranty or additional liability.
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
include AUTHORS
|
||||||
|
include ChangeLog
|
||||||
|
exclude .gitignore
|
||||||
|
exclude .gitreview
|
||||||
|
|
||||||
|
global-exclude *.pyc
|
|
@ -1,4 +0,0 @@
|
||||||
openstack-containers
|
|
||||||
====================
|
|
||||||
|
|
||||||
This is the new Openstack project for containers.
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
===============================
|
||||||
|
magnum
|
||||||
|
===============================
|
||||||
|
|
||||||
|
new Openstack project for containers.
|
||||||
|
|
||||||
|
* Free software: Apache license
|
||||||
|
* Documentation: http://docs.openstack.org/developer/magnum
|
||||||
|
* Source: http://git.openstack.org/cgit/stackforge/magnum
|
||||||
|
* Bugs: http://bugs.launchpad.net/magnum
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* TODO
|
|
@ -0,0 +1,75 @@
|
||||||
|
# -*- 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
|
||||||
|
#
|
||||||
|
# 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 os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.abspath('../..'))
|
||||||
|
# -- General configuration ----------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
#'sphinx.ext.intersphinx',
|
||||||
|
'oslosphinx'
|
||||||
|
]
|
||||||
|
|
||||||
|
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||||
|
# text edit cycles.
|
||||||
|
# execute "export SPHINX_DEBUG=1" in your terminal to disable
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'magnum'
|
||||||
|
copyright = u'2013, OpenStack Foundation'
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
add_module_names = True
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# -- Options for HTML output --------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||||
|
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||||
|
# html_theme_path = ["."]
|
||||||
|
# html_theme = '_theme'
|
||||||
|
# html_static_path = ['static']
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = '%sdoc' % project
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass
|
||||||
|
# [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('index',
|
||||||
|
'%s.tex' % project,
|
||||||
|
u'%s Documentation' % project,
|
||||||
|
u'OpenStack Foundation', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
|
#intersphinx_mapping = {'http://docs.python.org/': None}
|
|
@ -0,0 +1,4 @@
|
||||||
|
============
|
||||||
|
Contributing
|
||||||
|
============
|
||||||
|
.. include:: ../../CONTRIBUTING.rst
|
|
@ -0,0 +1,25 @@
|
||||||
|
.. magnum documentation master file, created by
|
||||||
|
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Welcome to magnum's documentation!
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
readme
|
||||||
|
installation
|
||||||
|
usage
|
||||||
|
contributing
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
============
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
At the command line::
|
||||||
|
|
||||||
|
$ pip install magnum
|
||||||
|
|
||||||
|
Or, if you have virtualenvwrapper installed::
|
||||||
|
|
||||||
|
$ mkvirtualenv magnum
|
||||||
|
$ pip install magnum
|
|
@ -0,0 +1 @@
|
||||||
|
.. include:: ../../README.rst
|
|
@ -0,0 +1,7 @@
|
||||||
|
========
|
||||||
|
Usage
|
||||||
|
========
|
||||||
|
|
||||||
|
To use magnum in a project::
|
||||||
|
|
||||||
|
import magnum
|
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
import pbr.version
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = pbr.version.VersionInfo(
|
||||||
|
'magnum').version_string()
|
||||||
|
|
||||||
# Make a project global TLS trace storage repository
|
# Make a project global TLS trace storage repository
|
||||||
TLS = threading.local()
|
TLS = threading.local()
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
from pecan import make_app
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
from api import model
|
# 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 pecan
|
||||||
|
|
||||||
|
from magnum.api import model
|
||||||
|
|
||||||
|
|
||||||
def setup_app(config):
|
def setup_app(config):
|
||||||
|
@ -7,7 +20,7 @@ def setup_app(config):
|
||||||
model.init_model()
|
model.init_model()
|
||||||
app_conf = dict(config.app)
|
app_conf = dict(config.app)
|
||||||
|
|
||||||
return make_app(
|
return pecan.make_app(
|
||||||
app_conf.pop('root'),
|
app_conf.pop('root'),
|
||||||
logging=getattr(config, 'logging', {}),
|
logging=getattr(config, 'logging', {}),
|
||||||
**app_conf
|
**app_conf
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
from pecan import expose, redirect
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
from api.controllers import v1
|
# 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 magnum.api.controllers import v1
|
||||||
|
|
||||||
|
|
||||||
class RootController(object):
|
class RootController(object):
|
||||||
|
|
|
@ -1,24 +1,34 @@
|
||||||
|
# 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 ast
|
import ast
|
||||||
import base64
|
|
||||||
import copy
|
|
||||||
import datetime
|
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
|
||||||
import uuid
|
import uuid
|
||||||
import pecan
|
|
||||||
import wsme
|
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.utils import netutils
|
|
||||||
from oslo.utils import strutils
|
from oslo.utils import strutils
|
||||||
from oslo.utils import timeutils
|
from oslo.utils import timeutils
|
||||||
|
import pecan
|
||||||
|
from pecan import rest
|
||||||
|
import six
|
||||||
|
import wsme
|
||||||
|
from wsme import exc
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
import wsmeext.pecan as wsme_pecan
|
import wsmeext.pecan as wsme_pecan
|
||||||
from pecan import rest, response
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE(dims): We don't depend on oslo*i18n yet
|
||||||
|
_ = _LI = _LW = _LE = _LC = lambda x: x
|
||||||
|
|
||||||
state_kind = ["ok", "containers", "insufficient data"]
|
state_kind = ["ok", "containers", "insufficient data"]
|
||||||
state_kind_enum = wtypes.Enum(str, *state_kind)
|
state_kind_enum = wtypes.Enum(str, *state_kind)
|
||||||
operation_kind = ('lt', 'le', 'eq', 'ne', 'ge', 'gt')
|
operation_kind = ('lt', 'le', 'eq', 'ne', 'ge', 'gt')
|
||||||
|
@ -128,17 +138,17 @@ class Query(_Base):
|
||||||
msg = (_('Unable to convert the value %(value)s'
|
msg = (_('Unable to convert the value %(value)s'
|
||||||
' to the expected data type %(type)s.') %
|
' to the expected data type %(type)s.') %
|
||||||
{'value': self.value, 'type': type})
|
{'value': self.value, 'type': type})
|
||||||
raise ClientSideError(msg)
|
raise exc.ClientSideError(msg)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
msg = (_('The data type %(type)s is not supported. The supported'
|
msg = (_('The data type %(type)s is not supported. The supported'
|
||||||
' data type list is: %(supported)s') %
|
' data type list is: %(supported)s') %
|
||||||
{'type': type, 'supported': self._supported_types})
|
{'type': type, 'supported': self._supported_types})
|
||||||
raise ClientSideError(msg)
|
raise exc.ClientSideError(msg)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = (_('Unexpected exception converting %(value)s to'
|
msg = (_('Unexpected exception converting %(value)s to'
|
||||||
' the expected data type %(type)s.') %
|
' the expected data type %(type)s.') %
|
||||||
{'value': self.value, 'type': type})
|
{'value': self.value, 'type': type})
|
||||||
raise ClientSideError(msg)
|
raise exc.ClientSideError(msg)
|
||||||
return converted_value
|
return converted_value
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,24 +175,24 @@ class ContainerController(rest.RestController):
|
||||||
|
|
||||||
@wsme_pecan.wsexpose([Container], [Query], int)
|
@wsme_pecan.wsexpose([Container], [Query], int)
|
||||||
def get_all(self, q=None, limit=None):
|
def get_all(self, q=None, limit=None):
|
||||||
# TODO: Returns all the containers
|
# TODO(dims): Returns all the containers
|
||||||
response.status = 200
|
pecan.response.status = 200
|
||||||
return
|
return
|
||||||
|
|
||||||
@wsme_pecan.wsexpose(Container, wtypes.text)
|
@wsme_pecan.wsexpose(Container, wtypes.text)
|
||||||
def get_one(self, container_id):
|
def get_one(self, container_id):
|
||||||
# TODO: Returns all the containers
|
# TODO(dims): Returns all the containers
|
||||||
response.status = 200
|
pecan.response.status = 200
|
||||||
return
|
return
|
||||||
|
|
||||||
@wsme_pecan.wsexpose([Container], body=[Container])
|
@wsme_pecan.wsexpose([Container], body=[Container])
|
||||||
def post(self, data):
|
def post(self, data):
|
||||||
# TODO: Create a new container
|
# TODO(dims): Create a new container
|
||||||
response.status = 201
|
pecan.response.status = 201
|
||||||
return
|
return
|
||||||
|
|
||||||
@wsme_pecan.wsexpose(None, status_code=204)
|
@wsme_pecan.wsexpose(None, status_code=204)
|
||||||
def delete(self):
|
def delete(self):
|
||||||
# TODO: DELETE the containers
|
# TODO(dims): DELETE the containers
|
||||||
response.status = 204
|
pecan.response.status = 204
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
|
# 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 pecan import conf # noqa
|
from pecan import conf # noqa
|
||||||
|
|
||||||
|
|
||||||
def init_model():
|
def init_model():
|
||||||
"""
|
"""This is a stub method which is called at application startup time.
|
||||||
This is a stub method which is called at application startup time.
|
|
||||||
|
|
||||||
If you need to bind to a parsed database configuration, set up tables or
|
If you need to bind to a parsed database configuration, set up tables or
|
||||||
ORM classes, or perform any database initialization, this is the
|
ORM classes, or perform any database initialization, this is the
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from solum import version
|
from magnum import version
|
||||||
|
|
||||||
|
|
||||||
def parse_args(argv, default_config_files=None):
|
def parse_args(argv, default_config_files=None):
|
||||||
cfg.CONF(argv[1:],
|
cfg.CONF(argv[1:],
|
||||||
project='solum',
|
project='magnum',
|
||||||
version=version.version_string(),
|
version=version.version_string,
|
||||||
default_config_files=default_config_files)
|
default_config_files=default_config_files)
|
||||||
|
|
|
@ -1,22 +1,36 @@
|
||||||
|
# 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 os
|
import os
|
||||||
from unittest import TestCase
|
import unittest
|
||||||
from pecan import set_config
|
|
||||||
from pecan.testing import load_test_app
|
import pecan
|
||||||
|
from pecan import testing
|
||||||
|
|
||||||
__all__ = ['FunctionalTest']
|
__all__ = ['FunctionalTest']
|
||||||
|
|
||||||
|
|
||||||
class FunctionalTest(TestCase):
|
class FunctionalTest(unittest.TestCase):
|
||||||
"""
|
"""Functional tests
|
||||||
|
|
||||||
Used for functional tests where you need to test your
|
Used for functional tests where you need to test your
|
||||||
literal application and its integration with the framework.
|
literal application and its integration with the framework.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.app = load_test_app(os.path.join(
|
self.app = testing.load_test_app(os.path.join(
|
||||||
os.path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
'config.py'
|
'config.py'
|
||||||
))
|
))
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
set_config({}, overwrite=True)
|
pecan.set_config({}, overwrite=True)
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2010-2011 OpenStack Foundation
|
||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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 oslotest import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestCase(base.BaseTestCase):
|
||||||
|
|
||||||
|
"""Test case base class for all unit tests."""
|
|
@ -1,3 +1,15 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
# Server Specific Configurations
|
# Server Specific Configurations
|
||||||
server = {
|
server = {
|
||||||
'port': '8080',
|
'port': '8080',
|
||||||
|
@ -6,8 +18,8 @@ server = {
|
||||||
|
|
||||||
# Pecan Application Configurations
|
# Pecan Application Configurations
|
||||||
app = {
|
app = {
|
||||||
'root': 'api.controllers.root.RootController',
|
'root': 'magnum.api.controllers.root.RootController',
|
||||||
'modules': ['api'],
|
'modules': ['magnum.api'],
|
||||||
'static_root': '%(confdir)s/../../public',
|
'static_root': '%(confdir)s/../../public',
|
||||||
'template_path': '%(confdir)s/../templates',
|
'template_path': '%(confdir)s/../templates',
|
||||||
'debug': True,
|
'debug': True,
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
from unittest import TestCase
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
from webtest import TestApp
|
# you may not use this file except in compliance with the License.
|
||||||
from api.tests import FunctionalTest
|
# 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 magnum import tests
|
||||||
|
|
||||||
|
|
||||||
class TestRootController(FunctionalTest):
|
class TestRootController(tests.FunctionalTest):
|
||||||
|
|
||||||
def test_get(self):
|
def test_get_all(self):
|
||||||
response = self.app.get('/')
|
response = self.app.get('/v1/containers')
|
||||||
assert response.status_int == 200
|
assert response.status_int == 200
|
||||||
|
|
||||||
def test_search(self):
|
|
||||||
response = self.app.post('/', params={'q': 'RestController'})
|
|
||||||
assert response.status_int == 302
|
|
||||||
assert response.headers['Location'] == (
|
|
||||||
'http://pecan.readthedocs.org/en/latest/search.html'
|
|
||||||
'?q=RestController'
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_get_not_found(self):
|
def test_get_not_found(self):
|
||||||
response = self.app.get('/a/bogus/url', expect_errors=True)
|
response = self.app.get('/a/bogus/url', expect_errors=True)
|
||||||
assert response.status_int == 404
|
assert response.status_int == 404
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# -*- 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
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""
|
||||||
|
test_magnum
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
Tests for `magnum` module.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from magnum.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestMagnum(base.TestCase):
|
||||||
|
|
||||||
|
def test_something(self):
|
||||||
|
pass
|
|
@ -1,7 +1,19 @@
|
||||||
from unittest import TestCase
|
# 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 unittest
|
||||||
|
|
||||||
|
|
||||||
class TestUnits(TestCase):
|
class TestUnits(unittest.TestCase):
|
||||||
|
|
||||||
def test_units(self):
|
def test_units(self):
|
||||||
assert 5 * 5 == 25
|
assert 5 * 5 == 25
|
||||||
|
|
|
@ -17,5 +17,5 @@
|
||||||
import pbr.version
|
import pbr.version
|
||||||
|
|
||||||
|
|
||||||
version_info = pbr.version.VersionInfo('solum')
|
version_info = pbr.version.VersionInfo('magnum')
|
||||||
version_string = version_info.version_string
|
version_string = version_info.version_string
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[DEFAULT]
|
||||||
|
|
||||||
|
# The list of modules to copy from oslo-incubator.git
|
||||||
|
|
||||||
|
# The base module to hold the copy of openstack.common
|
||||||
|
base=magnum
|
|
@ -1,6 +1,12 @@
|
||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
pbr>=0.6,!=0.7,<1.0
|
||||||
|
Babel>=1.3
|
||||||
|
|
||||||
oslo.config>=1.2.1
|
oslo.config>=1.2.1
|
||||||
oslo.utils>=1.0.0
|
oslo.utils>=1.0.0
|
||||||
pbr>=0.6,!=0.7,<1.0
|
|
||||||
pecan>=0.5.0
|
pecan>=0.5.0
|
||||||
python-keystoneclient>=0.9.0
|
python-keystoneclient>=0.9.0
|
||||||
python-zaqarclient>=0.0.3
|
python-zaqarclient>=0.0.3
|
||||||
|
|
11
setup.cfg
11
setup.cfg
|
@ -1,9 +1,8 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = magnum
|
name = magnum
|
||||||
version = 0.0.1
|
summary = Container Management project for OpenStack
|
||||||
summary = Application Lifecycle Management for OpenStack
|
|
||||||
description-file =
|
description-file =
|
||||||
README.md
|
README.rst
|
||||||
author = OpenStack
|
author = OpenStack
|
||||||
author-email = openstack-dev@lists.openstack.org
|
author-email = openstack-dev@lists.openstack.org
|
||||||
home-page = http://www.openstack.org/
|
home-page = http://www.openstack.org/
|
||||||
|
@ -19,6 +18,7 @@ classifier =
|
||||||
Programming Language :: Python :: 2.6
|
Programming Language :: Python :: 2.6
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.3
|
Programming Language :: Python :: 3.3
|
||||||
|
Programming Language :: Python :: 3.4
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
|
@ -41,5 +41,10 @@ domain = magnum
|
||||||
output_dir = magnum/locale
|
output_dir = magnum/locale
|
||||||
input_file = magnum/locale/magnum.pot
|
input_file = magnum/locale/magnum.pot
|
||||||
|
|
||||||
|
[extract_messages]
|
||||||
|
keywords = _ gettext ngettext l_ lazy_gettext
|
||||||
|
mapping_file = babel.cfg
|
||||||
|
output_file = magnum/locale/magnum.pot
|
||||||
|
|
||||||
[wheel]
|
[wheel]
|
||||||
universal = 1
|
universal = 1
|
||||||
|
|
8
setup.py
8
setup.py
|
@ -17,14 +17,6 @@
|
||||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
|
||||||
# setuptools if some other modules registered functions in `atexit`.
|
|
||||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
|
||||||
try:
|
|
||||||
import multiprocessing # noqa
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
setup_requires=['pbr'],
|
setup_requires=['pbr'],
|
||||||
pbr=True)
|
pbr=True)
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
hacking>=0.9.2,<0.10
|
hacking>=0.9.2,<0.10
|
||||||
|
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
|
discover
|
||||||
fixtures>=0.3.14
|
fixtures>=0.3.14
|
||||||
python-subunit>=0.0.18
|
mock>=1.0
|
||||||
oslotest
|
nose
|
||||||
|
python-subunit
|
||||||
|
sphinx>=1.1.2
|
||||||
|
oslosphinx
|
||||||
|
oslotest>=1.1.0.0a1
|
||||||
testrepository>=0.0.18
|
testrepository>=0.0.18
|
||||||
testscenarios>=0.4
|
testscenarios>=0.4
|
||||||
testtools>=0.9.34
|
testtools>=0.9.34
|
||||||
mock>=1.0
|
|
||||||
nose
|
|
||||||
|
|
26
tox.ini
26
tox.ini
|
@ -1,6 +1,6 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
envlist = py26,py27,py33,py34,pypy,pep8
|
envlist = py33,py34,py26,py27,pypy,pep8
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
@ -13,25 +13,23 @@ deps = -r{toxinidir}/requirements.txt
|
||||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands =
|
commands = flake8
|
||||||
flake8
|
|
||||||
{toxinidir}/tools/config/check_uptodate.sh
|
|
||||||
{toxinidir}/tools/check_for_alembic_branches.sh
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
commands = ./coverage.sh {posargs}
|
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:docs]
|
||||||
|
commands = python setup.py build_sphinx
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# H803 skipped on purpose per list discussion.
|
# H803 skipped on purpose per list discussion.
|
||||||
# E123, E125 skipped as they are invalid PEP-8.
|
# E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126
|
||||||
|
# The rest of the ignores are TODOs
|
||||||
|
# New from hacking 0.9: E129, E131, H407, H405, H904
|
||||||
|
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
|
||||||
|
|
||||||
show-source = True
|
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,H803,H904
|
||||||
ignore = E123,E125,H803
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||||
builtins = _
|
|
||||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
|
||||||
|
|
||||||
[hacking]
|
|
||||||
import_exceptions = solum.openstack.common.gettextutils._
|
|
||||||
|
|
Loading…
Reference in New Issue