From 9bd22e2c77675a0b051c183d5952e387e4f46a1a Mon Sep 17 00:00:00 2001 From: digambar Date: Tue, 9 Sep 2014 17:34:53 +0530 Subject: [PATCH] Initial commit from github (squashed) These were the commits from github repo(s) 84d943e Initial commit 3d15bd1 Created the pecan project for containers for API b49297b Added rest functionality to the v2 apis 227e1dd Added rest functionality to the v2 apis 39500ae Added the base API call like POST, GET, PUT & DELETE. e404e94 adding wsme support to pecan f90f540 Added wsme support to the magnum apis c879329 added changes to api 24ebc32 Fixed the bugs in the container apis 01725ef Rename dir from containers to magnum 1a1375a Add requirements and test-requirements f957e2e Add ASL2.0 license 8f4c0ee Move tests to the proper location 48dd100 Move setup files to proper directory 86cc435 Fix the setup so the installation is sanitary b766d59 Make the installation and tox testing work c477236 This is a new project - start with v1 for api cf20cac Remove pep8 errors d23b325 Merge with code generated using OpenStack cookie-cutter b6b9f34 Ability to run pecan serve from command line Had to update requirements.txt to get jobs working Change-Id: I068389412d023c258bda40dfbdff5a40f2e7d175 Co-Authored-By: Digambar Patil Co-Authored-By: Steven Dake --- .coveragerc | 7 + .gitignore | 53 ++++++++ .mailmap | 3 + .testr.conf | 7 + CONTRIBUTING.rst | 17 +++ HACKING.rst | 4 + LICENSE | 176 +++++++++++++++++++++++++ MANIFEST.in | 6 + README.rst | 15 +++ babel.cfg | 2 + doc/source/conf.py | 75 +++++++++++ doc/source/contributing.rst | 4 + doc/source/index.rst | 25 ++++ doc/source/installation.rst | 12 ++ doc/source/readme.rst | 1 + doc/source/usage.rst | 7 + magnum/MANIFEST.in | 1 + magnum/__init__.py | 22 ++++ magnum/api/__init__.py | 0 magnum/api/app.py | 27 ++++ magnum/api/controllers/__init__.py | 0 magnum/api/controllers/root.py | 17 +++ magnum/api/controllers/v1.py | 198 +++++++++++++++++++++++++++++ magnum/api/model/__init__.py | 26 ++++ magnum/api/templates/error.html | 12 ++ magnum/api/templates/index.html | 34 +++++ magnum/api/templates/layout.html | 22 ++++ magnum/config.py | 81 ++++++++++++ magnum/public/css/style.css | 43 +++++++ magnum/public/images/logo.png | Bin 0 -> 20596 bytes magnum/tests/__init__.py | 36 ++++++ magnum/tests/base.py | 23 ++++ magnum/tests/config.py | 37 ++++++ magnum/tests/test_functional.py | 24 ++++ magnum/tests/test_magnum.py | 28 ++++ magnum/tests/test_units.py | 19 +++ magnum/version.py | 21 +++ openstack-common.conf | 6 + requirements.txt | 14 ++ setup.cfg | 50 ++++++++ setup.py | 22 ++++ test-requirements.txt | 18 +++ tox.ini | 35 +++++ 43 files changed, 1230 insertions(+) create mode 100644 .coveragerc create mode 100644 .gitignore create mode 100644 .mailmap create mode 100644 .testr.conf create mode 100644 CONTRIBUTING.rst create mode 100644 HACKING.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 babel.cfg create mode 100755 doc/source/conf.py create mode 100644 doc/source/contributing.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/installation.rst create mode 100644 doc/source/readme.rst create mode 100644 doc/source/usage.rst create mode 100644 magnum/MANIFEST.in create mode 100644 magnum/__init__.py create mode 100644 magnum/api/__init__.py create mode 100644 magnum/api/app.py create mode 100644 magnum/api/controllers/__init__.py create mode 100644 magnum/api/controllers/root.py create mode 100644 magnum/api/controllers/v1.py create mode 100644 magnum/api/model/__init__.py create mode 100644 magnum/api/templates/error.html create mode 100644 magnum/api/templates/index.html create mode 100644 magnum/api/templates/layout.html create mode 100644 magnum/config.py create mode 100644 magnum/public/css/style.css create mode 100644 magnum/public/images/logo.png create mode 100644 magnum/tests/__init__.py create mode 100644 magnum/tests/base.py create mode 100644 magnum/tests/config.py create mode 100644 magnum/tests/test_functional.py create mode 100644 magnum/tests/test_magnum.py create mode 100644 magnum/tests/test_units.py create mode 100644 magnum/version.py create mode 100644 openstack-common.conf create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..68e128226c --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = magnum +omit = magnum/tests/*,magnum/openstack/* + +[report] +ignore-errors = True diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..8a3c704293 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +*.py[cod] + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +.testrepository +.venv + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.*sw? diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..516ae6fe01 --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000000..6d83b3c4ec --- /dev/null +++ b/.testr.conf @@ -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 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000000..330220ed7b --- /dev/null +++ b/CONTRIBUTING.rst @@ -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 diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 0000000000..f30ceffd6f --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +magnum Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..68c771a099 --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..c978a52dae --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc diff --git a/README.rst b/README.rst new file mode 100644 index 0000000000..4e88263066 --- /dev/null +++ b/README.rst @@ -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 diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000000..15cd6cb76b --- /dev/null +++ b/babel.cfg @@ -0,0 +1,2 @@ +[python: **.py] + diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100755 index 0000000000..615e2607ba --- /dev/null +++ b/doc/source/conf.py @@ -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} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 0000000000..1728a61ca2 --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,4 @@ +============ +Contributing +============ +.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000000..1193fe1c2a --- /dev/null +++ b/doc/source/index.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` + diff --git a/doc/source/installation.rst b/doc/source/installation.rst new file mode 100644 index 0000000000..9c0443d174 --- /dev/null +++ b/doc/source/installation.rst @@ -0,0 +1,12 @@ +============ +Installation +============ + +At the command line:: + + $ pip install magnum + +Or, if you have virtualenvwrapper installed:: + + $ mkvirtualenv magnum + $ pip install magnum diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 0000000000..a6210d3d8a --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../../README.rst diff --git a/doc/source/usage.rst b/doc/source/usage.rst new file mode 100644 index 0000000000..03c14efb09 --- /dev/null +++ b/doc/source/usage.rst @@ -0,0 +1,7 @@ +======== +Usage +======== + +To use magnum in a project:: + + import magnum diff --git a/magnum/MANIFEST.in b/magnum/MANIFEST.in new file mode 100644 index 0000000000..c922f11ad7 --- /dev/null +++ b/magnum/MANIFEST.in @@ -0,0 +1 @@ +recursive-include public * diff --git a/magnum/__init__.py b/magnum/__init__.py new file mode 100644 index 0000000000..222507a6cf --- /dev/null +++ b/magnum/__init__.py @@ -0,0 +1,22 @@ +# 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 threading + +import pbr.version + + +__version__ = pbr.version.VersionInfo( + 'magnum').version_string() + +# Make a project global TLS trace storage repository +TLS = threading.local() diff --git a/magnum/api/__init__.py b/magnum/api/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/magnum/api/app.py b/magnum/api/app.py new file mode 100644 index 0000000000..a342061503 --- /dev/null +++ b/magnum/api/app.py @@ -0,0 +1,27 @@ +# 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 pecan + +from magnum.api import model + + +def setup_app(config): + + model.init_model() + app_conf = dict(config.app) + + return pecan.make_app( + app_conf.pop('root'), + logging=getattr(config, 'logging', {}), + **app_conf + ) diff --git a/magnum/api/controllers/__init__.py b/magnum/api/controllers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/magnum/api/controllers/root.py b/magnum/api/controllers/root.py new file mode 100644 index 0000000000..d0a85c674c --- /dev/null +++ b/magnum/api/controllers/root.py @@ -0,0 +1,17 @@ +# 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 magnum.api.controllers import v1 + + +class RootController(object): + v1 = v1.ContainerController() diff --git a/magnum/api/controllers/v1.py b/magnum/api/controllers/v1.py new file mode 100644 index 0000000000..c65c84d7ad --- /dev/null +++ b/magnum/api/controllers/v1.py @@ -0,0 +1,198 @@ +# 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 functools +import inspect +import uuid + +from oslo.utils import strutils +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 +import wsmeext.pecan as wsme_pecan + + +# 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_enum = wtypes.Enum(str, *state_kind) +operation_kind = ('lt', 'le', 'eq', 'ne', 'ge', 'gt') +operation_kind_enum = wtypes.Enum(str, *operation_kind) + + +class _Base(wtypes.Base): + + @classmethod + def from_db_model(cls, m): + return cls(**(m.as_dict())) + + @classmethod + def from_db_and_links(cls, m, links): + return cls(links=links, **(m.as_dict())) + + def as_dict(self, db_model): + valid_keys = inspect.getargspec(db_model.__init__)[0] + if 'self' in valid_keys: + valid_keys.remove('self') + return self.as_dict_from_keys(valid_keys) + + def as_dict_from_keys(self, keys): + return dict((k, getattr(self, k)) + for k in keys + if hasattr(self, k) and + getattr(self, k) != wsme.Unset) + + +class Query(_Base): + + """Query filter.""" + + # The data types supported by the query. + _supported_types = ['integer', 'float', 'string', 'boolean'] + + # Functions to convert the data field to the correct type. + _type_converters = {'integer': int, + 'float': float, + 'boolean': functools.partial( + strutils.bool_from_string, strict=True), + 'string': six.text_type, + 'datetime': timeutils.parse_isotime} + + _op = None # provide a default + + def get_op(self): + return self._op or 'eq' + + def set_op(self, value): + self._op = value + + field = wtypes.text + "The name of the field to test" + + # op = wsme.wsattr(operation_kind, default='eq') + # this ^ doesn't seem to work. + op = wsme.wsproperty(operation_kind_enum, get_op, set_op) + "The comparison operator. Defaults to 'eq'." + + value = wtypes.text + "The value to compare against the stored data" + + type = wtypes.text + "The data type of value to compare against the stored data" + + def __repr__(self): + # for logging calls + return '' % (self.field, + self.op, + self.value, + self.type) + + @classmethod + def sample(cls): + return cls(field='resource_id', + op='eq', + value='bd9431c1-8d69-4ad3-803a-8d4a6b89fd36', + type='string' + ) + + def as_dict(self): + return self.as_dict_from_keys(['field', 'op', 'type', 'value']) + + def _get_value_as_type(self, forced_type=None): + """Convert metadata value to the specified data type. + """ + type = forced_type or self.type + try: + converted_value = self.value + if not type: + try: + converted_value = ast.literal_eval(self.value) + except (ValueError, SyntaxError): + # Unable to convert the metadata value automatically + # let it default to self.value + pass + else: + if type not in self._supported_types: + # Types must be explicitly declared so the + # correct type converter may be used. Subclasses + # of Query may define _supported_types and + # _type_converters to define their own types. + raise TypeError() + converted_value = self._type_converters[type](self.value) + except ValueError: + msg = (_('Unable to convert the value %(value)s' + ' to the expected data type %(type)s.') % + {'value': self.value, 'type': type}) + raise exc.ClientSideError(msg) + except TypeError: + msg = (_('The data type %(type)s is not supported. The supported' + ' data type list is: %(supported)s') % + {'type': type, 'supported': self._supported_types}) + raise exc.ClientSideError(msg) + except Exception: + msg = (_('Unexpected exception converting %(value)s to' + ' the expected data type %(type)s.') % + {'value': self.value, 'type': type}) + raise exc.ClientSideError(msg) + return converted_value + + +class Container(_Base): + container_id = wtypes.text + """ The ID of the containers.""" + + name = wsme.wsattr(wtypes.text, mandatory=True) + """ The name of the container.""" + + desc = wsme.wsattr(wtypes.text, mandatory=True) + + def __init__(self, **kwargs): + super(Container, self).__init__(**kwargs) + + @classmethod + def sample(cls): + return cls(id=str(uuid.uuid1(), + name="Docker", + desc='Docker Containers')) + + +class ContainerController(rest.RestController): + + @wsme_pecan.wsexpose([Container], [Query], int) + def get_all(self, q=None, limit=None): + # TODO(dims): Returns all the containers + pecan.response.status = 200 + return + + @wsme_pecan.wsexpose(Container, wtypes.text) + def get_one(self, container_id): + # TODO(dims): Returns all the containers + pecan.response.status = 200 + return + + @wsme_pecan.wsexpose([Container], body=[Container]) + def post(self, data): + # TODO(dims): Create a new container + pecan.response.status = 201 + return + + @wsme_pecan.wsexpose(None, status_code=204) + def delete(self): + # TODO(dims): DELETE the containers + pecan.response.status = 204 + return diff --git a/magnum/api/model/__init__.py b/magnum/api/model/__init__.py new file mode 100644 index 0000000000..9c177bcb0e --- /dev/null +++ b/magnum/api/model/__init__.py @@ -0,0 +1,26 @@ +# 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 + + +def init_model(): + """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 + ORM classes, or perform any database initialization, this is the + recommended place to do it. + + For more information working with databases, and some common recipes, + see http://pecan.readthedocs.org/en/latest/databases.html + """ + pass diff --git a/magnum/api/templates/error.html b/magnum/api/templates/error.html new file mode 100644 index 0000000000..f2d9796143 --- /dev/null +++ b/magnum/api/templates/error.html @@ -0,0 +1,12 @@ +<%inherit file="layout.html" /> + +## provide definitions for blocks we want to redefine +<%def name="title()"> + Server Error ${status} + + +## now define the body of the template +
+

Server Error ${status}

+
+

${message}

diff --git a/magnum/api/templates/index.html b/magnum/api/templates/index.html new file mode 100644 index 0000000000..f17c3862ee --- /dev/null +++ b/magnum/api/templates/index.html @@ -0,0 +1,34 @@ +<%inherit file="layout.html" /> + +## provide definitions for blocks we want to redefine +<%def name="title()"> + Welcome to Pecan! + + +## now define the body of the template +
+

+
+ +
+ +

This is a sample Pecan project.

+ +

+ Instructions for getting started can be found online at pecanpy.org +

+ +

+ ...or you can search the documentation here: +

+ +
+
+ + +
+ Enter search terms or a module, class or function name. +
+ +
diff --git a/magnum/api/templates/layout.html b/magnum/api/templates/layout.html new file mode 100644 index 0000000000..409085919f --- /dev/null +++ b/magnum/api/templates/layout.html @@ -0,0 +1,22 @@ + + + ${self.title()} + ${self.style()} + ${self.javascript()} + + + ${self.body()} + + + +<%def name="title()"> + Default Title + + +<%def name="style()"> + + + +<%def name="javascript()"> + + diff --git a/magnum/config.py b/magnum/config.py new file mode 100644 index 0000000000..b54db29c6e --- /dev/null +++ b/magnum/config.py @@ -0,0 +1,81 @@ +# 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. + +"""Solum specific config handling.""" + +from oslo.config import cfg + +from magnum import version + +# Server Specific Configurations +server = { + 'port': '8080', + 'host': '0.0.0.0' +} + +# Pecan Application Configurations +app = { + 'root': 'magnum.api.controllers.root.RootController', + 'modules': ['magnum.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': { + 'magnum': {'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='magnum', + version=version.version_string, + default_config_files=default_config_files) diff --git a/magnum/public/css/style.css b/magnum/public/css/style.css new file mode 100644 index 0000000000..55c9db54a0 --- /dev/null +++ b/magnum/public/css/style.css @@ -0,0 +1,43 @@ +body { + background: #311F00; + color: white; + font-family: 'Helvetica Neue', 'Helvetica', 'Verdana', sans-serif; + padding: 1em 2em; +} + +a { + color: #FAFF78; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +div#content { + width: 800px; + margin: 0 auto; +} + +form { + margin: 0; + padding: 0; + border: 0; +} + +fieldset { + border: 0; +} + +input.error { + background: #FAFF78; +} + +header { + text-align: center; +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Futura-CondensedExtraBold', 'Futura', 'Helvetica', sans-serif; + text-transform: uppercase; +} diff --git a/magnum/public/images/logo.png b/magnum/public/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a8f403e4a4f3ce69a4577a46ae37f5633abb79fa GIT binary patch literal 20596 zcmd>^Q+plW(}ttQ_Ks~QO&WWLjcwbFZQIt4*|@Qt#>tMI#-Kp=`*i;FACh>Mdcxj0%_ z+nGZ^NTcMXd#I_d;zrDL^K{Q*Qjk&K6L=$#&GSp+z$iz_1S&y=htjx9d;?-*&}*2f z^+8HSP?$<$BZUN;fDvxdl}7rNB_t0wV{H+xYQNuYWq*unZ?7J;fmbcB{JSip-GW(J71AS3kC!ZgW}WLy zy-GB{mcIg$D0sxFU?C7Cm$(J|Y48rAQdOIV0UTd26ZdKK9O3L7xJ3xXH5B_p^>&Zt z{}?;RGc#xoiU_o)0bN}Av7Jg=+0?tBSePQcOzIs=kT0Bhx0*~g#NiX&!oqW|JOmqd zmf_S9O_5y`ha@)OGU^rz0zP$!x61`J=7rZPAHuWD@*o-}O2(uN1Dt7ncsyqDdefx( zV#3atI{0%p(o=rsz8N{54KJ|XF##ZjIs<8N}^3h~}-_JCblagXEz- zWLl({^K-jjkOj6ZjK@501;LIJz2Ur1S(BG<8vJE=!aG^5kjM^I>Q8lv=Uj&5JLl&b_4LaY2g6=dA8VA zZiWzkVZ2IzWZ=de1tG*Kp{X2%y`lWhbkW%n$9lS~YLn`JC2)9u9=(zx=|wy2%8OE{ z{(D4DFms_UW&(h=L+$#ZFcaZi3lX`3SlFPLj8KRIIh~-l$RI)krO~0&p;@G%tVLiN zMTJ)WD?#=ZNcRvMCy2!$?^zgyU~VT^Js8bC6elF)Kq(Q#@P0Wq$gLo2_~2`FoMO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zh%fE?c`u!e*ChLum=ihq2~xHP)jLqQXj$zX3L9WOmm$gZDCP^HO(hl+|8`-cS}3EY79;lnyr znR$-nIb%ZW0d*6$A_K0HoOe`jVRb3%I;!PJ$G=?#R8{iVM?C7*aOH!C-$S>p+p@9m zEu~VM)z^wkWIGYuz2WKiMyuGj^dIkBEX=BxjvCS&qbtAfWQY%yBk#1AetthOUImi5 z(GfpSmu+}vIs_GeF3-&W;>(+iL}u-W={{-h3NkOh_g_r6`aHXg=)iBP!m98n(fp8Z zYZ*~#f5D}ikIsX2Kn>;6j#@7JrAfcP0FhdyoYAAdS11LfjHQ}}QLg?W7r{5`FL#X|G%9*rmJG%yg}0cF_rv}7L#5`Vq`+u2`vtHDR$x~7PB(al&*=iwhqb2u9a zwj0f3<2_olcl-zj1X)F=_;ES5?LOSL9E8@$)nu%=y1WGs?mA7ey<@^|qP5hB zS^?k~3jD8$6B8N3prP0`_+5ED;3BKkjGfILRyY50s2V6QqvYZ-${!kUre925?TX-7 z@Nf};49y*V^x#;~rfGH}+I-x6q`<|ftIX?E*E%^U7N|40=qdaPn$8=&4%_FJRDdv@(vg?HuJvr!{ttM8qz z7pksev@y zm%zo&tRHd|c*LXRfBkD-!HVfw?1D2R``{oS})c5Rl` zk4BaEl2RuRBu?rNO9IYy*$1IkJCF|n_pq)bX#UxG7RJ_2b-|gyc`~#Twi>wtBX}-c zEwTFb&hJ{TU;cB?|2g`9LkIBa*;yrrO|DATRd;lBXl2(K39>8{>N1|T{Y&tu2h%{g zzV9v#j-Y=Dn#wd&JHIbZ|4~n~%sEjH`5bT6&MF)Euc|%2ozF9~Z)3>CN#+V4;L{NGW`a5)Iv$+GD-H7{!97Q8&^F$?ZQt|Q9+TSz0g$24b} ZD6?|u)*zSG3-Sw<9?1AXo%Yig{{dC~0l)wN literal 0 HcmV?d00001 diff --git a/magnum/tests/__init__.py b/magnum/tests/__init__.py new file mode 100644 index 0000000000..0284ec9da2 --- /dev/null +++ b/magnum/tests/__init__.py @@ -0,0 +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 unittest + +import pecan +from pecan import testing + +__all__ = ['FunctionalTest'] + + +class FunctionalTest(unittest.TestCase): + """Functional tests + + Used for functional tests where you need to test your + literal application and its integration with the framework. + """ + + def setUp(self): + self.app = testing.load_test_app(os.path.join( + os.path.dirname(__file__), + 'config.py' + )) + + def tearDown(self): + pecan.set_config({}, overwrite=True) diff --git a/magnum/tests/base.py b/magnum/tests/base.py new file mode 100644 index 0000000000..1c30cdb56e --- /dev/null +++ b/magnum/tests/base.py @@ -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.""" diff --git a/magnum/tests/config.py b/magnum/tests/config.py new file mode 100644 index 0000000000..d1d674259d --- /dev/null +++ b/magnum/tests/config.py @@ -0,0 +1,37 @@ +# 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 = { + 'port': '8080', + 'host': '0.0.0.0' +} + +# Pecan Application Configurations +app = { + 'root': 'magnum.api.controllers.root.RootController', + 'modules': ['magnum.api'], + 'static_root': '%(confdir)s/../../public', + 'template_path': '%(confdir)s/../templates', + 'debug': True, + 'errors': { + '404': '/error/404', + '__force_dict__': True + } +} + +# Custom Configurations must be in Python dictionary format:: +# +# foo = {'bar':'baz'} +# +# All configurations are accessible at:: +# pecan.conf diff --git a/magnum/tests/test_functional.py b/magnum/tests/test_functional.py new file mode 100644 index 0000000000..794d82b2a2 --- /dev/null +++ b/magnum/tests/test_functional.py @@ -0,0 +1,24 @@ +# 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 magnum import tests + + +class TestRootController(tests.FunctionalTest): + + def test_get_all(self): + response = self.app.get('/v1/containers') + assert response.status_int == 200 + + def test_get_not_found(self): + response = self.app.get('/a/bogus/url', expect_errors=True) + assert response.status_int == 404 diff --git a/magnum/tests/test_magnum.py b/magnum/tests/test_magnum.py new file mode 100644 index 0000000000..8173a921e7 --- /dev/null +++ b/magnum/tests/test_magnum.py @@ -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 diff --git a/magnum/tests/test_units.py b/magnum/tests/test_units.py new file mode 100644 index 0000000000..75a76d6a4c --- /dev/null +++ b/magnum/tests/test_units.py @@ -0,0 +1,19 @@ +# 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(unittest.TestCase): + + def test_units(self): + assert 5 * 5 == 25 diff --git a/magnum/version.py b/magnum/version.py new file mode 100644 index 0000000000..c9a048cfbf --- /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('magnum') +version_string = version_info.version_string diff --git a/openstack-common.conf b/openstack-common.conf new file mode 100644 index 0000000000..4c0bfaa747 --- /dev/null +++ b/openstack-common.conf @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..493e28af75 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +# 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.4.0 +oslo.utils>=1.0.0 +pecan>=0.8.0 +python-keystoneclient>=0.11.1 +python-zaqarclient>=0.0.3 +six>=1.7.0 +WSME>=0.6 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..fe941dff52 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,50 @@ +[metadata] +name = magnum +summary = Container Management project for OpenStack +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 + +[files] +packages = + magnum + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[compile_catalog] +directory = magnum/locale +domain = magnum + +[update_catalog] +domain = magnum +output_dir = magnum/locale +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] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..70c2b3f32b --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000000..50499e4d65 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +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 + +coverage>=3.6 +discover +fixtures>=0.3.14 +mock>=1.0 +nose +python-subunit>=0.0.18 +sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 +oslosphinx>=2.2.0 +oslotest>=1.2.0 +testrepository>=0.0.18 +testscenarios>=0.4 +testtools>=0.9.36,!=1.2.0,!=1.4.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000000..93935fa571 --- /dev/null +++ b/tox.ini @@ -0,0 +1,35 @@ +[tox] +minversion = 1.6 +envlist = py33,py34,py26,py27,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 + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py testr --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx + +[flake8] +# H803 skipped on purpose per list discussion. +# 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 + +ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,H803,H904 +exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools