From 2b282876de478b88fa084e099e4bbf358e4690c1 Mon Sep 17 00:00:00 2001 From: Serg Melikyan Date: Fri, 5 Apr 2013 17:14:35 +0400 Subject: [PATCH] Renamed Portas to API --- {portas => api}/.gitignore | 0 api/README.rst | 7 ++ {portas => api}/babel.cfg | 0 portas/bin/portas-api => api/bin/glazier-api | 25 +++--- .../doc/source/_static/.placeholder | 0 .../doc/source/_templates/.placeholder | 0 {portas => api}/doc/source/_theme/theme.conf | 0 {portas => api}/doc/source/conf.py | 22 +++-- {portas => api}/doc/source/index.rst | 5 +- {portas => api}/doc/source/man/portasapi.rst | 0 .../etc/glazier-api-paste.ini | 6 +- .../etc/glazier-api.conf | 2 +- api/glazierapi/__init__.py | 13 +++ api/glazierapi/api/__init__.py | 14 ++++ api/glazierapi/api/middleware/__init__.py | 14 ++++ .../glazierapi}/api/middleware/context.py | 18 ++--- .../glazierapi}/api/v1/__init__.py | 18 ++++- .../glazierapi}/api/v1/active_directories.py | 24 ++++-- .../glazierapi}/api/v1/environments.py | 26 ++++-- .../glazierapi}/api/v1/router.py | 12 ++- .../glazierapi}/api/v1/sessions.py | 24 ++++-- .../glazierapi}/api/v1/webservers.py | 24 ++++-- api/glazierapi/common/__init__.py | 14 ++++ .../glazierapi}/common/config.py | 22 ++--- .../glazierapi}/common/service.py | 24 ++++-- api/glazierapi/common/uuidutils.py | 19 +++++ {portas/portas => api/glazierapi}/context.py | 7 +- api/glazierapi/db/__init__.py | 26 ++++++ .../glazierapi}/db/migrate_repo/README | 0 .../glazierapi}/db/migrate_repo/__init__.py | 0 api/glazierapi/db/migrate_repo/manage.py | 20 +++++ .../glazierapi}/db/migrate_repo/migrate.cfg | 4 +- .../versions/001_add_initial_tables.py | 14 ++++ .../versions/002_add_session_table.py | 14 ++++ .../versions/003_add_status_table.py | 14 ++++ .../004_add_description_column_to_session.py | 31 +++++++ .../005_remove_obsolete_service_table.py | 14 ++++ .../006_add_entity_id_column_to_status.py | 31 +++++++ .../db/migrate_repo/versions}/__init__.py | 0 .../portas => api/glazierapi}/db/models.py | 14 ++-- .../portas => api/glazierapi}/db/session.py | 4 +- .../locale/ru/LC_MESSAGES/glazierapi.po | 0 .../glazierapi/openstack}/__init__.py | 0 .../glazierapi/openstack/common}/__init__.py | 0 .../openstack/common/eventlet_backdoor.py | 0 .../glazierapi}/openstack/common/exception.py | 2 +- .../openstack/common/gettextutils.py | 2 +- .../openstack/common/importutils.py | 0 .../glazierapi}/openstack/common/jsonutils.py | 4 +- .../glazierapi}/openstack/common/local.py | 0 .../glazierapi}/openstack/common/log.py | 10 +-- .../openstack/common/loopingcall.py | 6 +- .../openstack/common/notifier/__init__.py | 0 .../openstack/common/notifier/api.py | 12 +-- .../openstack/common/notifier/log_notifier.py | 6 +- .../common/notifier/no_op_notifier.py | 0 .../common/notifier/rabbit_notifier.py | 6 +- .../openstack/common/notifier/rpc_notifier.py | 8 +- .../common/notifier/rpc_notifier2.py | 8 +- .../common/notifier/test_notifier.py | 0 .../glazierapi}/openstack/common/service.py | 12 +-- .../glazierapi}/openstack/common/setup.py | 0 .../glazierapi}/openstack/common/sslutils.py | 2 +- .../openstack/common/threadgroup.py | 4 +- .../glazierapi}/openstack/common/timeutils.py | 0 .../glazierapi}/openstack/common/uuidutils.py | 0 .../glazierapi}/openstack/common/version.py | 2 +- .../glazierapi}/openstack/common/wsgi.py | 14 ++-- .../glazierapi}/openstack/common/xmlutils.py | 0 api/glazierapi/tests/__init__.py | 13 +++ api/glazierapi/tests/api/__init__.py | 13 +++ .../glazierapi/tests/api/simple_test.py | 10 +-- .../glazierapi}/tests/sanity_tests.py | 23 +++--- api/glazierapi/utils.py | 38 +++++++++ api/glazierapi/version.py | 17 ++++ {portas => api}/openstack-common.conf | 2 +- {portas => api}/run_tests.sh | 2 +- {portas => api}/setup.cfg | 12 +-- api/setup.py | 49 +++++++++++ {portas => api}/tools/install_venv.py | 8 +- {portas => api}/tools/install_venv_common.py | 0 {portas => api}/tools/pip-requires | 0 {portas => api}/tools/test-requires | 0 {portas => api}/tools/with_venv.sh | 0 {portas => api}/tox.ini | 6 +- portas/README.rst | 7 -- portas/portas/common/__init__.py | 0 portas/portas/common/exception.py | 55 ------------- portas/portas/common/uuidutils.py | 5 -- portas/portas/db/__init__.py | 12 --- portas/portas/db/migrate_repo/manage.py | 21 ----- .../004_add_description_column_to_session.py | 17 ---- .../006_add_entity_id_column_to_status.py | 17 ---- .../db/migrate_repo/versions/__init__.py | 0 portas/portas/openstack/__init__.py | 0 portas/portas/openstack/common/__init__.py | 0 portas/portas/schema.py | 81 ------------------- portas/portas/tests/__init__.py | 14 ---- portas/portas/tests/api/__init__.py | 15 ---- portas/portas/tests/api/simple_test.py | 22 ----- portas/portas/utils.py | 24 ------ portas/setup.py | 50 ------------ 102 files changed, 630 insertions(+), 527 deletions(-) rename {portas => api}/.gitignore (100%) create mode 100644 api/README.rst rename {portas => api}/babel.cfg (100%) rename portas/bin/portas-api => api/bin/glazier-api (75%) rename {portas => api}/doc/source/_static/.placeholder (100%) rename {portas => api}/doc/source/_templates/.placeholder (100%) rename {portas => api}/doc/source/_theme/theme.conf (100%) rename {portas => api}/doc/source/conf.py (94%) rename {portas => api}/doc/source/index.rst (96%) rename {portas => api}/doc/source/man/portasapi.rst (100%) rename portas/etc/portas-api-paste.ini => api/etc/glazier-api-paste.ini (67%) rename portas/etc/portas-api.conf => api/etc/glazier-api.conf (94%) create mode 100644 api/glazierapi/__init__.py create mode 100644 api/glazierapi/api/__init__.py create mode 100644 api/glazierapi/api/middleware/__init__.py rename {portas/portas => api/glazierapi}/api/middleware/context.py (88%) rename {portas/portas => api/glazierapi}/api/v1/__init__.py (78%) rename {portas/portas => api/glazierapi}/api/v1/active_directories.py (72%) rename {portas/portas => api/glazierapi}/api/v1/environments.py (80%) rename {portas/portas => api/glazierapi}/api/v1/router.py (95%) rename {portas/portas => api/glazierapi}/api/v1/sessions.py (85%) rename {portas/portas => api/glazierapi}/api/v1/webservers.py (70%) create mode 100644 api/glazierapi/common/__init__.py rename {portas/portas => api/glazierapi}/common/config.py (89%) rename {portas/portas => api/glazierapi}/common/service.py (78%) create mode 100644 api/glazierapi/common/uuidutils.py rename {portas/portas => api/glazierapi}/context.py (92%) create mode 100644 api/glazierapi/db/__init__.py rename {portas/portas => api/glazierapi}/db/migrate_repo/README (100%) rename {portas/portas => api/glazierapi}/db/migrate_repo/__init__.py (100%) create mode 100644 api/glazierapi/db/migrate_repo/manage.py rename {portas/portas => api/glazierapi}/db/migrate_repo/migrate.cfg (91%) rename {portas/portas => api/glazierapi}/db/migrate_repo/versions/001_add_initial_tables.py (62%) rename {portas/portas => api/glazierapi}/db/migrate_repo/versions/002_add_session_table.py (54%) rename {portas/portas => api/glazierapi}/db/migrate_repo/versions/003_add_status_table.py (56%) create mode 100644 api/glazierapi/db/migrate_repo/versions/004_add_description_column_to_session.py rename {portas/portas => api/glazierapi}/db/migrate_repo/versions/005_remove_obsolete_service_table.py (57%) create mode 100644 api/glazierapi/db/migrate_repo/versions/006_add_entity_id_column_to_status.py rename {portas/portas => api/glazierapi/db/migrate_repo/versions}/__init__.py (100%) rename {portas/portas => api/glazierapi}/db/models.py (92%) rename {portas/portas => api/glazierapi}/db/session.py (97%) rename portas/portas/locale/ru/LC_MESSAGES/portas.po => api/glazierapi/locale/ru/LC_MESSAGES/glazierapi.po (100%) rename {portas/portas/api => api/glazierapi/openstack}/__init__.py (100%) rename {portas/portas/api/middleware => api/glazierapi/openstack/common}/__init__.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/eventlet_backdoor.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/exception.py (98%) rename {portas/portas => api/glazierapi}/openstack/common/gettextutils.py (93%) rename {portas/portas => api/glazierapi}/openstack/common/importutils.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/jsonutils.py (98%) rename {portas/portas => api/glazierapi}/openstack/common/local.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/log.py (98%) rename {portas/portas => api/glazierapi}/openstack/common/loopingcall.py (94%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/__init__.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/api.py (94%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/log_notifier.py (87%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/no_op_notifier.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/rabbit_notifier.py (84%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/rpc_notifier.py (87%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/rpc_notifier2.py (88%) rename {portas/portas => api/glazierapi}/openstack/common/notifier/test_notifier.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/service.py (96%) rename {portas/portas => api/glazierapi}/openstack/common/setup.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/sslutils.py (97%) rename {portas/portas => api/glazierapi}/openstack/common/threadgroup.py (96%) rename {portas/portas => api/glazierapi}/openstack/common/timeutils.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/uuidutils.py (100%) rename {portas/portas => api/glazierapi}/openstack/common/version.py (98%) rename {portas/portas => api/glazierapi}/openstack/common/wsgi.py (98%) rename {portas/portas => api/glazierapi}/openstack/common/xmlutils.py (100%) create mode 100644 api/glazierapi/tests/__init__.py create mode 100644 api/glazierapi/tests/api/__init__.py rename portas/portas/version.py => api/glazierapi/tests/api/simple_test.py (74%) rename {portas/portas => api/glazierapi}/tests/sanity_tests.py (50%) create mode 100644 api/glazierapi/utils.py create mode 100644 api/glazierapi/version.py rename {portas => api}/openstack-common.conf (95%) rename {portas => api}/run_tests.sh (98%) rename {portas => api}/setup.cfg (74%) create mode 100644 api/setup.py rename {portas => api}/tools/install_venv.py (89%) rename {portas => api}/tools/install_venv_common.py (100%) rename {portas => api}/tools/pip-requires (100%) rename {portas => api}/tools/test-requires (100%) rename {portas => api}/tools/with_venv.sh (100%) rename {portas => api}/tox.ini (80%) delete mode 100644 portas/README.rst delete mode 100644 portas/portas/common/__init__.py delete mode 100644 portas/portas/common/exception.py delete mode 100644 portas/portas/common/uuidutils.py delete mode 100644 portas/portas/db/__init__.py delete mode 100644 portas/portas/db/migrate_repo/manage.py delete mode 100644 portas/portas/db/migrate_repo/versions/004_add_description_column_to_session.py delete mode 100644 portas/portas/db/migrate_repo/versions/006_add_entity_id_column_to_status.py delete mode 100644 portas/portas/db/migrate_repo/versions/__init__.py delete mode 100644 portas/portas/openstack/__init__.py delete mode 100644 portas/portas/openstack/common/__init__.py delete mode 100644 portas/portas/schema.py delete mode 100644 portas/portas/tests/__init__.py delete mode 100644 portas/portas/tests/api/__init__.py delete mode 100644 portas/portas/tests/api/simple_test.py delete mode 100644 portas/portas/utils.py delete mode 100644 portas/setup.py diff --git a/portas/.gitignore b/api/.gitignore similarity index 100% rename from portas/.gitignore rename to api/.gitignore diff --git a/api/README.rst b/api/README.rst new file mode 100644 index 00000000..02ee2a7c --- /dev/null +++ b/api/README.rst @@ -0,0 +1,7 @@ +Glazier API README +===================== +Glazier API is a project that provides access to engine via API. + +SEE ALSO +-------- +* `Glazier `__ diff --git a/portas/babel.cfg b/api/babel.cfg similarity index 100% rename from portas/babel.cfg rename to api/babel.cfg diff --git a/portas/bin/portas-api b/api/bin/glazier-api similarity index 75% rename from portas/bin/portas-api rename to api/bin/glazier-api index bcf7b312..24962190 100755 --- a/portas/bin/portas-api +++ b/api/bin/glazier-api @@ -1,8 +1,6 @@ #!/usr/bin/env python -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011 OpenStack LLC. -# All Rights Reserved. +# +# Copyright (c) 2013 Mirantis, 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 @@ -14,14 +12,15 @@ # 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. +# under the License.from oslo.config import cfg + import gettext import os import sys -# If ../portas/__init__.py exists, add ../ to Python search path, so that +# If ../glazierapi/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... -from portas.common.service import TaskResultHandlerService +from glazierapi.common.service import TaskResultHandlerService possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, @@ -29,17 +28,17 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'portas', '__init__.py')): sys.path.insert(0, possible_topdir) -from portas.common import config -from portas.openstack.common import log -from portas.openstack.common import wsgi -from portas.openstack.common import service +from glazierapi.common import config +from glazierapi.openstack.common import log +from glazierapi.openstack.common import wsgi +from glazierapi.openstack.common import service -gettext.install('portas', './portas/locale', unicode=1) +gettext.install('glazierapi', './glazierapi/locale', unicode=1) if __name__ == '__main__': try: config.parse_args() - log.setup('portas') + log.setup('glazierapi') launcher = service.ServiceLauncher() diff --git a/portas/doc/source/_static/.placeholder b/api/doc/source/_static/.placeholder similarity index 100% rename from portas/doc/source/_static/.placeholder rename to api/doc/source/_static/.placeholder diff --git a/portas/doc/source/_templates/.placeholder b/api/doc/source/_templates/.placeholder similarity index 100% rename from portas/doc/source/_templates/.placeholder rename to api/doc/source/_templates/.placeholder diff --git a/portas/doc/source/_theme/theme.conf b/api/doc/source/_theme/theme.conf similarity index 100% rename from portas/doc/source/_theme/theme.conf rename to api/doc/source/_theme/theme.conf diff --git a/portas/doc/source/conf.py b/api/doc/source/conf.py similarity index 94% rename from portas/doc/source/conf.py rename to api/doc/source/conf.py index 1cc6ec4b..28c8b685 100644 --- a/portas/doc/source/conf.py +++ b/api/doc/source/conf.py @@ -1,4 +1,3 @@ - # -*- coding: utf-8 -*- # Copyright (c) 2010 OpenStack Foundation. # @@ -34,10 +33,9 @@ import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path = [os.path.abspath('../../portas'), - os.path.abspath('../..'), - os.path.abspath('../../bin') - ] + sys.path +sys.path = [os.path.abspath('../../glazierapi'), + os.path.abspath('../..'), + os.path.abspath('../../bin')] + sys.path # -- General configuration --------------------------------------------------- @@ -67,7 +65,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Portas' +project = u'Glazier APIs' copyright = u'2013, Mirantis, Inc' # The version info for the project you're documenting, acts as replacement for @@ -75,7 +73,7 @@ copyright = u'2013, Mirantis, Inc' # built documents. # # The short X.Y version. -from portas.version import version_info as portas_version +from glazierapi.version import version_info as portas_version # The full version, including alpha/beta/rc tags. release = portas_version.version_string_with_vcs() # The short X.Y version. @@ -116,7 +114,7 @@ show_authors = True pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -modindex_common_prefix = ['portas.'] +modindex_common_prefix = ['glazierapi.'] # -- Options for man page output -------------------------------------------- @@ -124,7 +122,7 @@ modindex_common_prefix = ['portas.'] # List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' man_pages = [ - ('man/portasapi', 'portas-api', u'Portas API Server', + ('man/glazierapi', 'glazier-api', u'Glazier API Server', [u'Mirantis, Inc'], 1) ] @@ -203,7 +201,7 @@ html_use_index = False #html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = 'portasdoc' +htmlhelp_basename = 'glazierapidoc' # -- Options for LaTeX output ------------------------------------------------ @@ -218,8 +216,8 @@ htmlhelp_basename = 'portasdoc' # (source start file, target name, title, author, # documentclass [howto/manual]). latex_documents = [ - ('index', 'Portas.tex', u'Portas Documentation', - u'Keero Team', 'manual'), + ('index', 'Glazier.tex', u'Glazier Documentation', + u'Mirantis, Inc', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/portas/doc/source/index.rst b/api/doc/source/index.rst similarity index 96% rename from portas/doc/source/index.rst rename to api/doc/source/index.rst index dcff6da5..3c385138 100644 --- a/portas/doc/source/index.rst +++ b/api/doc/source/index.rst @@ -1,12 +1,11 @@ .. - Copyright 2010 OpenStack Foundation - All Rights Reserved. + Copyright (c) 2013 Mirantis, 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 + 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 diff --git a/portas/doc/source/man/portasapi.rst b/api/doc/source/man/portasapi.rst similarity index 100% rename from portas/doc/source/man/portasapi.rst rename to api/doc/source/man/portasapi.rst diff --git a/portas/etc/portas-api-paste.ini b/api/etc/glazier-api-paste.ini similarity index 67% rename from portas/etc/portas-api-paste.ini rename to api/etc/glazier-api-paste.ini index 3c4b22f9..f02d0c14 100644 --- a/portas/etc/portas-api-paste.ini +++ b/api/etc/glazier-api-paste.ini @@ -1,11 +1,11 @@ -[pipeline:portas-api] +[pipeline:glazier-api] pipeline = authtoken context apiv1app [app:apiv1app] -paste.app_factory = portas.api.v1.router:API.factory +paste.app_factory = glazierapi.api.v1.router:API.factory [filter:context] -paste.filter_factory = portas.api.middleware.context:ContextMiddleware.factory +paste.filter_factory = glazierapi.api.middleware.context:ContextMiddleware.factory [filter:authtoken] paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory diff --git a/portas/etc/portas-api.conf b/api/etc/glazier-api.conf similarity index 94% rename from portas/etc/portas-api.conf rename to api/etc/glazier-api.conf index a292b82e..5cf698e8 100644 --- a/portas/etc/portas-api.conf +++ b/api/etc/glazier-api.conf @@ -16,7 +16,7 @@ bind_port = 8082 log_file = /tmp/portas-api.log #A valid SQLAlchemy connection string for the metadata database -sql_connection = sqlite:///portas.sqlite +sql_connection = sqlite:///glazier.sqlite [reports] results_exchange = task-results diff --git a/api/glazierapi/__init__.py b/api/glazierapi/__init__.py new file mode 100644 index 00000000..207fa154 --- /dev/null +++ b/api/glazierapi/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2013 Mirantis, 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. \ No newline at end of file diff --git a/api/glazierapi/api/__init__.py b/api/glazierapi/api/__init__.py new file mode 100644 index 00000000..fc46f490 --- /dev/null +++ b/api/glazierapi/api/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + diff --git a/api/glazierapi/api/middleware/__init__.py b/api/glazierapi/api/middleware/__init__.py new file mode 100644 index 00000000..fc46f490 --- /dev/null +++ b/api/glazierapi/api/middleware/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + diff --git a/portas/portas/api/middleware/context.py b/api/glazierapi/api/middleware/context.py similarity index 88% rename from portas/portas/api/middleware/context.py rename to api/glazierapi/api/middleware/context.py index b7ff31da..6d82abde 100644 --- a/portas/portas/api/middleware/context.py +++ b/api/glazierapi/api/middleware/context.py @@ -1,7 +1,4 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011-2012 OpenStack LLC. -# All Rights Reserved. +# Copyright (c) 2013 Mirantis, 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 @@ -13,16 +10,17 @@ # 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. +# under the License.from oslo.config import cfg + import json from oslo.config import cfg import webob.exc -from portas.openstack.common import wsgi -import portas.context -import portas.openstack.common.log as logging +from glazierapi.openstack.common import wsgi +import glazierapi.context +import glazierapi.openstack.common.log as logging CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -43,7 +41,7 @@ class ContextMiddleware(BaseContextMiddleware): def process_request(self, req): """Convert authentication information into a request context - Generate a portas.context.RequestContext object from the available + Generate a glazierapi.context.RequestContext object from the available authentication headers and store on the 'context' attribute of the req object. @@ -77,7 +75,7 @@ class ContextMiddleware(BaseContextMiddleware): 'service_catalog': service_catalog, 'session': req.headers.get('X-Configuration-Session') } - req.context = portas.context.RequestContext(**kwargs) + req.context = glazierapi.context.RequestContext(**kwargs) else: raise webob.exc.HTTPUnauthorized() diff --git a/portas/portas/api/v1/__init__.py b/api/glazierapi/api/v1/__init__.py similarity index 78% rename from portas/portas/api/v1/__init__.py rename to api/glazierapi/api/v1/__init__.py index 062b734d..7a46398e 100644 --- a/portas/portas/api/v1/__init__.py +++ b/api/glazierapi/api/v1/__init__.py @@ -1,5 +1,19 @@ -from portas.db.models import Session, Environment, Status -from portas.db.session import get_session +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from glazierapi.db.models import Session, Environment, Status +from glazierapi.db.session import get_session def get_draft(environment_id=None, session_id=None): diff --git a/portas/portas/api/v1/active_directories.py b/api/glazierapi/api/v1/active_directories.py similarity index 72% rename from portas/portas/api/v1/active_directories.py rename to api/glazierapi/api/v1/active_directories.py index ade7a6fc..12416b1c 100644 --- a/portas/portas/api/v1/active_directories.py +++ b/api/glazierapi/api/v1/active_directories.py @@ -1,8 +1,22 @@ -from portas import utils -from portas.api.v1 import save_draft, get_draft, get_service_status -from portas.common import uuidutils -from portas.openstack.common import wsgi, timeutils -from portas.openstack.common import log as logging +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from glazierapi import utils +from glazierapi.api.v1 import save_draft, get_draft, get_service_status +from glazierapi.common import uuidutils +from glazierapi.openstack.common import wsgi, timeutils +from glazierapi.openstack.common import log as logging log = logging.getLogger(__name__) diff --git a/portas/portas/api/v1/environments.py b/api/glazierapi/api/v1/environments.py similarity index 80% rename from portas/portas/api/v1/environments.py rename to api/glazierapi/api/v1/environments.py index 2473d4dd..5bb67022 100644 --- a/portas/portas/api/v1/environments.py +++ b/api/glazierapi/api/v1/environments.py @@ -1,13 +1,27 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from amqplib.client_0_8 import Message import anyjson import eventlet from webob import exc -from portas.common import config -from portas.api.v1 import get_env_status -from portas.db.session import get_session -from portas.db.models import Environment -from portas.openstack.common import wsgi -from portas.openstack.common import log as logging +from glazierapi.common import config +from glazierapi.api.v1 import get_env_status +from glazierapi.db.session import get_session +from glazierapi.db.models import Environment +from glazierapi.openstack.common import wsgi +from glazierapi.openstack.common import log as logging amqp = eventlet.patcher.import_patched('amqplib.client_0_8') rabbitmq = config.CONF.rabbitmq diff --git a/portas/portas/api/v1/router.py b/api/glazierapi/api/v1/router.py similarity index 95% rename from portas/portas/api/v1/router.py rename to api/glazierapi/api/v1/router.py index ed0da258..998ee316 100644 --- a/portas/portas/api/v1/router.py +++ b/api/glazierapi/api/v1/router.py @@ -1,7 +1,4 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011 OpenStack LLC. -# All Rights Reserved. +# Copyright (c) 2013 Mirantis, 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 @@ -13,10 +10,11 @@ # 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. +# under the License.from oslo.config import cfg + import routes -from portas.openstack.common import wsgi -from portas.api.v1 import (environments, sessions, +from glazierapi.openstack.common import wsgi +from glazierapi.api.v1 import (environments, sessions, active_directories, webservers) diff --git a/portas/portas/api/v1/sessions.py b/api/glazierapi/api/v1/sessions.py similarity index 85% rename from portas/portas/api/v1/sessions.py rename to api/glazierapi/api/v1/sessions.py index 8d533c2e..15654461 100644 --- a/portas/portas/api/v1/sessions.py +++ b/api/glazierapi/api/v1/sessions.py @@ -1,12 +1,26 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from amqplib.client_0_8 import Message import anyjson import eventlet from webob import exc -from portas.common import config -from portas.db.models import Session, Status, Environment -from portas.db.session import get_session -from portas.openstack.common import wsgi -from portas.openstack.common import log as logging +from glazierapi.common import config +from glazierapi.db.models import Session, Status, Environment +from glazierapi.db.session import get_session +from glazierapi.openstack.common import wsgi +from glazierapi.openstack.common import log as logging amqp = eventlet.patcher.import_patched('amqplib.client_0_8') rabbitmq = config.CONF.rabbitmq diff --git a/portas/portas/api/v1/webservers.py b/api/glazierapi/api/v1/webservers.py similarity index 70% rename from portas/portas/api/v1/webservers.py rename to api/glazierapi/api/v1/webservers.py index b0e23568..876c9d2c 100644 --- a/portas/portas/api/v1/webservers.py +++ b/api/glazierapi/api/v1/webservers.py @@ -1,8 +1,22 @@ -from portas import utils -from portas.api.v1 import save_draft, get_draft, get_service_status -from portas.common import uuidutils -from portas.openstack.common import wsgi, timeutils -from portas.openstack.common import log as logging +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from glazierapi import utils +from glazierapi.api.v1 import save_draft, get_draft, get_service_status +from glazierapi.common import uuidutils +from glazierapi.openstack.common import wsgi, timeutils +from glazierapi.openstack.common import log as logging log = logging.getLogger(__name__) diff --git a/api/glazierapi/common/__init__.py b/api/glazierapi/common/__init__.py new file mode 100644 index 00000000..fc46f490 --- /dev/null +++ b/api/glazierapi/common/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + diff --git a/portas/portas/common/config.py b/api/glazierapi/common/config.py similarity index 89% rename from portas/portas/common/config.py rename to api/glazierapi/common/config.py index 691351ae..a5bfd854 100644 --- a/portas/portas/common/config.py +++ b/api/glazierapi/common/config.py @@ -29,7 +29,7 @@ import sys from oslo.config import cfg from paste import deploy -from portas.version import version_info as version +from glazierapi.version import version_info as version paste_deploy_opts = [ cfg.StrOpt('flavor'), @@ -65,20 +65,20 @@ CONF.register_opts(reports_opts, group='reports') CONF.register_opts(rabbit_opts, group='rabbitmq') -CONF.import_opt('verbose', 'portas.openstack.common.log') -CONF.import_opt('debug', 'portas.openstack.common.log') -CONF.import_opt('log_dir', 'portas.openstack.common.log') -CONF.import_opt('log_file', 'portas.openstack.common.log') -CONF.import_opt('log_config', 'portas.openstack.common.log') -CONF.import_opt('log_format', 'portas.openstack.common.log') -CONF.import_opt('log_date_format', 'portas.openstack.common.log') -CONF.import_opt('use_syslog', 'portas.openstack.common.log') -CONF.import_opt('syslog_log_facility', 'portas.openstack.common.log') +CONF.import_opt('verbose', 'glazierapi.openstack.common.log') +CONF.import_opt('debug', 'glazierapi.openstack.common.log') +CONF.import_opt('log_dir', 'glazierapi.openstack.common.log') +CONF.import_opt('log_file', 'glazierapi.openstack.common.log') +CONF.import_opt('log_config', 'glazierapi.openstack.common.log') +CONF.import_opt('log_format', 'glazierapi.openstack.common.log') +CONF.import_opt('log_date_format', 'glazierapi.openstack.common.log') +CONF.import_opt('use_syslog', 'glazierapi.openstack.common.log') +CONF.import_opt('syslog_log_facility', 'glazierapi.openstack.common.log') def parse_args(args=None, usage=None, default_config_files=None): CONF(args=args, - project='portas', + project='glazierapi', version=version.cached_version_string(), usage=usage, default_config_files=default_config_files) diff --git a/portas/portas/common/service.py b/api/glazierapi/common/service.py similarity index 78% rename from portas/portas/common/service.py rename to api/glazierapi/common/service.py index 2c20c1f2..8b2d7342 100644 --- a/portas/portas/common/service.py +++ b/api/glazierapi/common/service.py @@ -1,13 +1,27 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + import anyjson from eventlet import patcher -from portas.db.models import Status, Session, Environment -from portas.db.session import get_session +from glazierapi.db.models import Status, Session, Environment +from glazierapi.db.session import get_session amqp = patcher.import_patched('amqplib.client_0_8') -from portas.openstack.common import service -from portas.openstack.common import log as logging -from portas.common import config +from glazierapi.openstack.common import service +from glazierapi.openstack.common import log as logging +from glazierapi.common import config conf = config.CONF.reports rabbitmq = config.CONF.rabbitmq diff --git a/api/glazierapi/common/uuidutils.py b/api/glazierapi/common/uuidutils.py new file mode 100644 index 00000000..86b85193 --- /dev/null +++ b/api/glazierapi/common/uuidutils.py @@ -0,0 +1,19 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +import uuid + + +def generate_uuid(): + return str(uuid.uuid4()).replace('-', '') diff --git a/portas/portas/context.py b/api/glazierapi/context.py similarity index 92% rename from portas/portas/context.py rename to api/glazierapi/context.py index 9db108dc..2bea96f5 100644 --- a/portas/portas/context.py +++ b/api/glazierapi/context.py @@ -1,7 +1,4 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011-2012 OpenStack LLC. -# All Rights Reserved. +# Copyright (c) 2013 Mirantis, 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 @@ -15,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from portas.openstack.common import uuidutils +from glazierapi.openstack.common import uuidutils class RequestContext(object): diff --git a/api/glazierapi/db/__init__.py b/api/glazierapi/db/__init__.py new file mode 100644 index 00000000..374c1328 --- /dev/null +++ b/api/glazierapi/db/__init__.py @@ -0,0 +1,26 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from oslo.config import cfg + +sql_connection_opt = cfg.StrOpt('sql_connection', + default='sqlite:///glazierapi.sqlite', + secret=True, + metavar='CONNECTION', + help='A valid SQLAlchemy connection ' + 'string for the metadata database. ' + 'Default: %(default)s') + +CONF = cfg.CONF +CONF.register_opt(sql_connection_opt) diff --git a/portas/portas/db/migrate_repo/README b/api/glazierapi/db/migrate_repo/README similarity index 100% rename from portas/portas/db/migrate_repo/README rename to api/glazierapi/db/migrate_repo/README diff --git a/portas/portas/db/migrate_repo/__init__.py b/api/glazierapi/db/migrate_repo/__init__.py similarity index 100% rename from portas/portas/db/migrate_repo/__init__.py rename to api/glazierapi/db/migrate_repo/__init__.py diff --git a/api/glazierapi/db/migrate_repo/manage.py b/api/glazierapi/db/migrate_repo/manage.py new file mode 100644 index 00000000..cc59d86b --- /dev/null +++ b/api/glazierapi/db/migrate_repo/manage.py @@ -0,0 +1,20 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + + +from migrate.versioning.shell import main + +# This should probably be a console script entry point. +if __name__ == '__main__': + main(debug='False', repository='.') diff --git a/portas/portas/db/migrate_repo/migrate.cfg b/api/glazierapi/db/migrate_repo/migrate.cfg similarity index 91% rename from portas/portas/db/migrate_repo/migrate.cfg rename to api/glazierapi/db/migrate_repo/migrate.cfg index 2ca05ccb..0f60e5a1 100644 --- a/portas/portas/db/migrate_repo/migrate.cfg +++ b/api/glazierapi/db/migrate_repo/migrate.cfg @@ -1,7 +1,7 @@ [db_settings] # Used to identify which repository this database is versioned under. # You can use the name of your project. -repository_id=Portas Migrations +repository_id=Glazier Migrations # The name of the database table used to track the schema version. # This name shouldn't already be used by your project. @@ -16,5 +16,5 @@ version_table=migrate_version # Databases in this list MUST compile successfully during a commit, or the # entire commit will fail. List the databases your application will actually # be using to ensure your updates to that database work properly. -# This must be a list; example: ['postgres','sqlite'] +# This must be a list; example: ['glazier','sqlite'] required_dbs=[] diff --git a/portas/portas/db/migrate_repo/versions/001_add_initial_tables.py b/api/glazierapi/db/migrate_repo/versions/001_add_initial_tables.py similarity index 62% rename from portas/portas/db/migrate_repo/versions/001_add_initial_tables.py rename to api/glazierapi/db/migrate_repo/versions/001_add_initial_tables.py index 52a6d164..8f74d10c 100644 --- a/portas/portas/db/migrate_repo/versions/001_add_initial_tables.py +++ b/api/glazierapi/db/migrate_repo/versions/001_add_initial_tables.py @@ -1,3 +1,17 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from sqlalchemy.schema import MetaData, Table, Column, ForeignKey from sqlalchemy.types import String, Text, DateTime diff --git a/portas/portas/db/migrate_repo/versions/002_add_session_table.py b/api/glazierapi/db/migrate_repo/versions/002_add_session_table.py similarity index 54% rename from portas/portas/db/migrate_repo/versions/002_add_session_table.py rename to api/glazierapi/db/migrate_repo/versions/002_add_session_table.py index 30f89c8c..cb794938 100644 --- a/portas/portas/db/migrate_repo/versions/002_add_session_table.py +++ b/api/glazierapi/db/migrate_repo/versions/002_add_session_table.py @@ -1,3 +1,17 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from sqlalchemy.schema import MetaData, Table, Column, ForeignKey from sqlalchemy.types import String, Text, DateTime diff --git a/portas/portas/db/migrate_repo/versions/003_add_status_table.py b/api/glazierapi/db/migrate_repo/versions/003_add_status_table.py similarity index 56% rename from portas/portas/db/migrate_repo/versions/003_add_status_table.py rename to api/glazierapi/db/migrate_repo/versions/003_add_status_table.py index 1ee86b2e..135c0bcd 100644 --- a/portas/portas/db/migrate_repo/versions/003_add_status_table.py +++ b/api/glazierapi/db/migrate_repo/versions/003_add_status_table.py @@ -1,3 +1,17 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from sqlalchemy.schema import MetaData, Table, Column, ForeignKey from sqlalchemy.types import String, Text, DateTime diff --git a/api/glazierapi/db/migrate_repo/versions/004_add_description_column_to_session.py b/api/glazierapi/db/migrate_repo/versions/004_add_description_column_to_session.py new file mode 100644 index 00000000..27ff7c7d --- /dev/null +++ b/api/glazierapi/db/migrate_repo/versions/004_add_description_column_to_session.py @@ -0,0 +1,31 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from sqlalchemy.schema import MetaData, Table, Column +from sqlalchemy.types import Text + +meta = MetaData() + + +def upgrade(migrate_engine): + meta.bind = migrate_engine + session = Table('session', meta, autoload=True) + description = Column('description', Text(), nullable=True, default='{}') + description.create(session) + + +def downgrade(migrate_engine): + meta.bind = migrate_engine + session = Table('session', meta, autoload=True) + session.c.description.drop() diff --git a/portas/portas/db/migrate_repo/versions/005_remove_obsolete_service_table.py b/api/glazierapi/db/migrate_repo/versions/005_remove_obsolete_service_table.py similarity index 57% rename from portas/portas/db/migrate_repo/versions/005_remove_obsolete_service_table.py rename to api/glazierapi/db/migrate_repo/versions/005_remove_obsolete_service_table.py index 8c3bfc1b..57be93da 100644 --- a/portas/portas/db/migrate_repo/versions/005_remove_obsolete_service_table.py +++ b/api/glazierapi/db/migrate_repo/versions/005_remove_obsolete_service_table.py @@ -1,3 +1,17 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + from sqlalchemy.schema import MetaData, Table, Column, ForeignKey from sqlalchemy.types import String, Text, DateTime diff --git a/api/glazierapi/db/migrate_repo/versions/006_add_entity_id_column_to_status.py b/api/glazierapi/db/migrate_repo/versions/006_add_entity_id_column_to_status.py new file mode 100644 index 00000000..2e938d1c --- /dev/null +++ b/api/glazierapi/db/migrate_repo/versions/006_add_entity_id_column_to_status.py @@ -0,0 +1,31 @@ +# Copyright (c) 2013 Mirantis, 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.from oslo.config import cfg + +from sqlalchemy.schema import MetaData, Table, Column +from sqlalchemy.types import String + +meta = MetaData() + + +def upgrade(migrate_engine): + meta.bind = migrate_engine + status = Table('status', meta, autoload=True) + entity_id = Column('entity_id', String(32), nullable=True) + entity_id.create(status) + + +def downgrade(migrate_engine): + meta.bind = migrate_engine + status = Table('status', meta, autoload=True) + status.c.entity_id.drop() diff --git a/portas/portas/__init__.py b/api/glazierapi/db/migrate_repo/versions/__init__.py similarity index 100% rename from portas/portas/__init__.py rename to api/glazierapi/db/migrate_repo/versions/__init__.py diff --git a/portas/portas/db/models.py b/api/glazierapi/db/models.py similarity index 92% rename from portas/portas/db/models.py rename to api/glazierapi/db/models.py index 9491bab4..ac373d23 100644 --- a/portas/portas/db/models.py +++ b/api/glazierapi/db/models.py @@ -1,8 +1,4 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. +# Copyright (c) 2013 Mirantis, 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 @@ -17,7 +13,7 @@ # under the License. """ -SQLAlchemy models for portas data +SQLAlchemy models for glazierapi data """ import anyjson @@ -26,10 +22,10 @@ from sqlalchemy.ext.compiler import compiles from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import DateTime, Text from sqlalchemy.orm import relationship, backref, object_mapper -from portas.common import uuidutils +from glazierapi.common import uuidutils -from portas.openstack.common import timeutils -from portas.db.session import get_session +from glazierapi.openstack.common import timeutils +from glazierapi.db.session import get_session BASE = declarative_base() diff --git a/portas/portas/db/session.py b/api/glazierapi/db/session.py similarity index 97% rename from portas/portas/db/session.py rename to api/glazierapi/db/session.py index 42d32f8a..2d94b973 100644 --- a/portas/portas/db/session.py +++ b/api/glazierapi/db/session.py @@ -30,9 +30,9 @@ from sqlalchemy.orm import sessionmaker from sqlalchemy.pool import NullPool from sqlalchemy.exc import DisconnectionError -from portas.common.config import CONF as conf +from glazierapi.common.config import CONF as conf -from portas.db import migrate_repo +from glazierapi.db import migrate_repo MAKER = None diff --git a/portas/portas/locale/ru/LC_MESSAGES/portas.po b/api/glazierapi/locale/ru/LC_MESSAGES/glazierapi.po similarity index 100% rename from portas/portas/locale/ru/LC_MESSAGES/portas.po rename to api/glazierapi/locale/ru/LC_MESSAGES/glazierapi.po diff --git a/portas/portas/api/__init__.py b/api/glazierapi/openstack/__init__.py similarity index 100% rename from portas/portas/api/__init__.py rename to api/glazierapi/openstack/__init__.py diff --git a/portas/portas/api/middleware/__init__.py b/api/glazierapi/openstack/common/__init__.py similarity index 100% rename from portas/portas/api/middleware/__init__.py rename to api/glazierapi/openstack/common/__init__.py diff --git a/portas/portas/openstack/common/eventlet_backdoor.py b/api/glazierapi/openstack/common/eventlet_backdoor.py similarity index 100% rename from portas/portas/openstack/common/eventlet_backdoor.py rename to api/glazierapi/openstack/common/eventlet_backdoor.py diff --git a/portas/portas/openstack/common/exception.py b/api/glazierapi/openstack/common/exception.py similarity index 98% rename from portas/portas/openstack/common/exception.py rename to api/glazierapi/openstack/common/exception.py index 14520189..02dffa4d 100644 --- a/portas/portas/openstack/common/exception.py +++ b/api/glazierapi/openstack/common/exception.py @@ -21,7 +21,7 @@ Exceptions common to OpenStack projects import logging -from portas.openstack.common.gettextutils import _ +from glazierapi.openstack.common.gettextutils import _ _FATAL_EXCEPTION_FORMAT_ERRORS = False diff --git a/portas/portas/openstack/common/gettextutils.py b/api/glazierapi/openstack/common/gettextutils.py similarity index 93% rename from portas/portas/openstack/common/gettextutils.py rename to api/glazierapi/openstack/common/gettextutils.py index e196060c..fb1a1b7b 100644 --- a/portas/portas/openstack/common/gettextutils.py +++ b/api/glazierapi/openstack/common/gettextutils.py @@ -20,7 +20,7 @@ gettext for openstack-common modules. Usual usage in an openstack.common module: - from portas.openstack.common.gettextutils import _ + from glazierapi.openstack.common.gettextutils import _ """ import gettext diff --git a/portas/portas/openstack/common/importutils.py b/api/glazierapi/openstack/common/importutils.py similarity index 100% rename from portas/portas/openstack/common/importutils.py rename to api/glazierapi/openstack/common/importutils.py diff --git a/portas/portas/openstack/common/jsonutils.py b/api/glazierapi/openstack/common/jsonutils.py similarity index 98% rename from portas/portas/openstack/common/jsonutils.py rename to api/glazierapi/openstack/common/jsonutils.py index 2682c394..4ef48ea6 100644 --- a/portas/portas/openstack/common/jsonutils.py +++ b/api/glazierapi/openstack/common/jsonutils.py @@ -41,8 +41,8 @@ import json import logging import xmlrpclib -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import timeutils +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/local.py b/api/glazierapi/openstack/common/local.py similarity index 100% rename from portas/portas/openstack/common/local.py rename to api/glazierapi/openstack/common/local.py diff --git a/portas/portas/openstack/common/log.py b/api/glazierapi/openstack/common/log.py similarity index 98% rename from portas/portas/openstack/common/log.py rename to api/glazierapi/openstack/common/log.py index 8e2dac27..e8caddb9 100644 --- a/portas/portas/openstack/common/log.py +++ b/api/glazierapi/openstack/common/log.py @@ -42,10 +42,10 @@ import traceback from oslo.config import cfg -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import jsonutils -from portas.openstack.common import local -from portas.openstack.common import notifier +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import jsonutils +from glazierapi.openstack.common import local +from glazierapi.openstack.common import notifier _DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s" @@ -305,7 +305,7 @@ class JSONFormatter(logging.Formatter): class PublishErrorsHandler(logging.Handler): def emit(self, record): - if ('portas.openstack.common.notifier.log_notifier' in + if ('glazierapi.openstack.common.notifier.log_notifier' in CONF.notification_driver): return notifier.api.notify(None, 'error.publisher', diff --git a/portas/portas/openstack/common/loopingcall.py b/api/glazierapi/openstack/common/loopingcall.py similarity index 94% rename from portas/portas/openstack/common/loopingcall.py rename to api/glazierapi/openstack/common/loopingcall.py index c2be723c..02420da4 100644 --- a/portas/portas/openstack/common/loopingcall.py +++ b/api/glazierapi/openstack/common/loopingcall.py @@ -22,9 +22,9 @@ import sys from eventlet import event from eventlet import greenthread -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import log as logging -from portas.openstack.common import timeutils +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/notifier/__init__.py b/api/glazierapi/openstack/common/notifier/__init__.py similarity index 100% rename from portas/portas/openstack/common/notifier/__init__.py rename to api/glazierapi/openstack/common/notifier/__init__.py diff --git a/portas/portas/openstack/common/notifier/api.py b/api/glazierapi/openstack/common/notifier/api.py similarity index 94% rename from portas/portas/openstack/common/notifier/api.py rename to api/glazierapi/openstack/common/notifier/api.py index af68d2d2..10e5f6cb 100644 --- a/portas/portas/openstack/common/notifier/api.py +++ b/api/glazierapi/openstack/common/notifier/api.py @@ -17,12 +17,12 @@ import uuid from oslo.config import cfg -from portas.openstack.common import context -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import importutils -from portas.openstack.common import jsonutils -from portas.openstack.common import log as logging -from portas.openstack.common import timeutils +from glazierapi.openstack.common import context +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import importutils +from glazierapi.openstack.common import jsonutils +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/notifier/log_notifier.py b/api/glazierapi/openstack/common/notifier/log_notifier.py similarity index 87% rename from portas/portas/openstack/common/notifier/log_notifier.py rename to api/glazierapi/openstack/common/notifier/log_notifier.py index bc4799fe..aa571abd 100644 --- a/portas/portas/openstack/common/notifier/log_notifier.py +++ b/api/glazierapi/openstack/common/notifier/log_notifier.py @@ -15,8 +15,8 @@ from oslo.config import cfg -from portas.openstack.common import jsonutils -from portas.openstack.common import log as logging +from glazierapi.openstack.common import jsonutils +from glazierapi.openstack.common import log as logging CONF = cfg.CONF @@ -30,6 +30,6 @@ def notify(_context, message): CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( - 'portas.openstack.common.notification.%s' % + 'glazierapi.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message)) diff --git a/portas/portas/openstack/common/notifier/no_op_notifier.py b/api/glazierapi/openstack/common/notifier/no_op_notifier.py similarity index 100% rename from portas/portas/openstack/common/notifier/no_op_notifier.py rename to api/glazierapi/openstack/common/notifier/no_op_notifier.py diff --git a/portas/portas/openstack/common/notifier/rabbit_notifier.py b/api/glazierapi/openstack/common/notifier/rabbit_notifier.py similarity index 84% rename from portas/portas/openstack/common/notifier/rabbit_notifier.py rename to api/glazierapi/openstack/common/notifier/rabbit_notifier.py index 0687cfd3..3d9c5e4d 100644 --- a/portas/portas/openstack/common/notifier/rabbit_notifier.py +++ b/api/glazierapi/openstack/common/notifier/rabbit_notifier.py @@ -14,9 +14,9 @@ # under the License. -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import log as logging -from portas.openstack.common.notifier import rpc_notifier +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common.notifier import rpc_notifier LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/notifier/rpc_notifier.py b/api/glazierapi/openstack/common/notifier/rpc_notifier.py similarity index 87% rename from portas/portas/openstack/common/notifier/rpc_notifier.py rename to api/glazierapi/openstack/common/notifier/rpc_notifier.py index e00d9dc0..145ac180 100644 --- a/portas/portas/openstack/common/notifier/rpc_notifier.py +++ b/api/glazierapi/openstack/common/notifier/rpc_notifier.py @@ -15,10 +15,10 @@ from oslo.config import cfg -from portas.openstack.common import context as req_context -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import log as logging -from portas.openstack.common import rpc +from glazierapi.openstack.common import context as req_context +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import rpc LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/notifier/rpc_notifier2.py b/api/glazierapi/openstack/common/notifier/rpc_notifier2.py similarity index 88% rename from portas/portas/openstack/common/notifier/rpc_notifier2.py rename to api/glazierapi/openstack/common/notifier/rpc_notifier2.py index b4afb9ab..f1e51ca6 100644 --- a/portas/portas/openstack/common/notifier/rpc_notifier2.py +++ b/api/glazierapi/openstack/common/notifier/rpc_notifier2.py @@ -17,10 +17,10 @@ from oslo.config import cfg -from portas.openstack.common import context as req_context -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import log as logging -from portas.openstack.common import rpc +from glazierapi.openstack.common import context as req_context +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import rpc LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/notifier/test_notifier.py b/api/glazierapi/openstack/common/notifier/test_notifier.py similarity index 100% rename from portas/portas/openstack/common/notifier/test_notifier.py rename to api/glazierapi/openstack/common/notifier/test_notifier.py diff --git a/portas/portas/openstack/common/service.py b/api/glazierapi/openstack/common/service.py similarity index 96% rename from portas/portas/openstack/common/service.py rename to api/glazierapi/openstack/common/service.py index 042c721a..1b89d44e 100644 --- a/portas/portas/openstack/common/service.py +++ b/api/glazierapi/openstack/common/service.py @@ -30,14 +30,14 @@ import eventlet import logging as std_logging from oslo.config import cfg -from portas.openstack.common import eventlet_backdoor -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import importutils -from portas.openstack.common import log as logging -from portas.openstack.common import threadgroup +from glazierapi.openstack.common import eventlet_backdoor +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import importutils +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import threadgroup -rpc = importutils.try_import('portas.openstack.common.rpc') +rpc = importutils.try_import('glazierapi.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/setup.py b/api/glazierapi/openstack/common/setup.py similarity index 100% rename from portas/portas/openstack/common/setup.py rename to api/glazierapi/openstack/common/setup.py diff --git a/portas/portas/openstack/common/sslutils.py b/api/glazierapi/openstack/common/sslutils.py similarity index 97% rename from portas/portas/openstack/common/sslutils.py rename to api/glazierapi/openstack/common/sslutils.py index 77f174c5..998f4fdb 100644 --- a/portas/portas/openstack/common/sslutils.py +++ b/api/glazierapi/openstack/common/sslutils.py @@ -19,7 +19,7 @@ import ssl from oslo.config import cfg -from portas.openstack.common.gettextutils import _ +from glazierapi.openstack.common.gettextutils import _ ssl_opts = [ diff --git a/portas/portas/openstack/common/threadgroup.py b/api/glazierapi/openstack/common/threadgroup.py similarity index 96% rename from portas/portas/openstack/common/threadgroup.py rename to api/glazierapi/openstack/common/threadgroup.py index 1835ac79..f38e7464 100644 --- a/portas/portas/openstack/common/threadgroup.py +++ b/api/glazierapi/openstack/common/threadgroup.py @@ -18,8 +18,8 @@ from eventlet import greenlet from eventlet import greenpool from eventlet import greenthread -from portas.openstack.common import log as logging -from portas.openstack.common import loopingcall +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import loopingcall LOG = logging.getLogger(__name__) diff --git a/portas/portas/openstack/common/timeutils.py b/api/glazierapi/openstack/common/timeutils.py similarity index 100% rename from portas/portas/openstack/common/timeutils.py rename to api/glazierapi/openstack/common/timeutils.py diff --git a/portas/portas/openstack/common/uuidutils.py b/api/glazierapi/openstack/common/uuidutils.py similarity index 100% rename from portas/portas/openstack/common/uuidutils.py rename to api/glazierapi/openstack/common/uuidutils.py diff --git a/portas/portas/openstack/common/version.py b/api/glazierapi/openstack/common/version.py similarity index 98% rename from portas/portas/openstack/common/version.py rename to api/glazierapi/openstack/common/version.py index 5c74fd27..e4eb6530 100644 --- a/portas/portas/openstack/common/version.py +++ b/api/glazierapi/openstack/common/version.py @@ -52,7 +52,7 @@ class VersionInfo(object): # The most likely cause for this is running tests in a tree # produced from a tarball where the package itself has not been # installed into anything. Revert to setup-time logic. - from portas.openstack.common import setup + from glazierapi.openstack.common import setup return setup.get_version(self.package) def release_string(self): diff --git a/portas/portas/openstack/common/wsgi.py b/api/glazierapi/openstack/common/wsgi.py similarity index 98% rename from portas/portas/openstack/common/wsgi.py rename to api/glazierapi/openstack/common/wsgi.py index 4dd43e6c..e4f15fc0 100644 --- a/portas/portas/openstack/common/wsgi.py +++ b/api/glazierapi/openstack/common/wsgi.py @@ -35,13 +35,13 @@ import webob.exc from xml.dom import minidom from xml.parsers import expat -from portas.openstack.common import exception -from portas.openstack.common.gettextutils import _ -from portas.openstack.common import jsonutils -from portas.openstack.common import log as logging -from portas.openstack.common import service -from portas.openstack.common import sslutils -from portas.openstack.common import xmlutils +from glazierapi.openstack.common import exception +from glazierapi.openstack.common.gettextutils import _ +from glazierapi.openstack.common import jsonutils +from glazierapi.openstack.common import log as logging +from glazierapi.openstack.common import service +from glazierapi.openstack.common import sslutils +from glazierapi.openstack.common import xmlutils socket_opts = [ cfg.IntOpt('backlog', diff --git a/portas/portas/openstack/common/xmlutils.py b/api/glazierapi/openstack/common/xmlutils.py similarity index 100% rename from portas/portas/openstack/common/xmlutils.py rename to api/glazierapi/openstack/common/xmlutils.py diff --git a/api/glazierapi/tests/__init__.py b/api/glazierapi/tests/__init__.py new file mode 100644 index 00000000..7d93825c --- /dev/null +++ b/api/glazierapi/tests/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2013 Mirantis, 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. diff --git a/api/glazierapi/tests/api/__init__.py b/api/glazierapi/tests/api/__init__.py new file mode 100644 index 00000000..207fa154 --- /dev/null +++ b/api/glazierapi/tests/api/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2013 Mirantis, 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. \ No newline at end of file diff --git a/portas/portas/version.py b/api/glazierapi/tests/api/simple_test.py similarity index 74% rename from portas/portas/version.py rename to api/glazierapi/tests/api/simple_test.py index f740c7ee..72034e29 100644 --- a/portas/portas/version.py +++ b/api/glazierapi/tests/api/simple_test.py @@ -1,6 +1,4 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 OpenStack Foundation +# Copyright (c) 2013 Mirantis, 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 @@ -14,7 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest -from portas.openstack.common import version as common_version -version_info = common_version.VersionInfo('portas') +class Test(unittest.TestCase): + def test(self): + assert True diff --git a/portas/portas/tests/sanity_tests.py b/api/glazierapi/tests/sanity_tests.py similarity index 50% rename from portas/portas/tests/sanity_tests.py rename to api/glazierapi/tests/sanity_tests.py index 2e026a34..29e0df4f 100644 --- a/portas/portas/tests/sanity_tests.py +++ b/api/glazierapi/tests/sanity_tests.py @@ -1,22 +1,21 @@ -# Copyright (c) 2013 Mirantis Inc. +# Copyright (c) 2013 Mirantis, 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 +# 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 +# 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. +# 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 unittest2 from mock import MagicMock -import portas.api.v1.router as router +import glazierapi.api.v1.router as router def my_mock(link, controller, action, conditions): diff --git a/api/glazierapi/utils.py b/api/glazierapi/utils.py new file mode 100644 index 00000000..26fa6ae1 --- /dev/null +++ b/api/glazierapi/utils.py @@ -0,0 +1,38 @@ +# Copyright (c) 2013 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import functools +import logging +from webob import exc +from glazierapi.db.models import Session +from glazierapi.db.session import get_session + +log = logging.getLogger(__name__) + + +def verify_session(func): + @functools.wraps(func) + def __inner(self, request, *args, **kwargs): + if hasattr(request, 'context') and request.context.session: + uw = get_session().query(Session) + configuration_session = uw.get(request.context.session) + + if configuration_session.state != 'open': + log.info('Session is already deployed') + raise exc.HTTPUnauthorized + else: + log.info('No session is supplied') + raise exc.HTTPUnauthorized + return func(self, request, *args, **kwargs) + return __inner diff --git a/api/glazierapi/version.py b/api/glazierapi/version.py new file mode 100644 index 00000000..a0085f36 --- /dev/null +++ b/api/glazierapi/version.py @@ -0,0 +1,17 @@ +# Copyright (c) 2013 Mirantis, 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. + +from glazierapi.openstack.common import version as common_version + +version_info = common_version.VersionInfo('glazierapi') diff --git a/portas/openstack-common.conf b/api/openstack-common.conf similarity index 95% rename from portas/openstack-common.conf rename to api/openstack-common.conf index 6f1c5983..2bafe632 100644 --- a/portas/openstack-common.conf +++ b/api/openstack-common.conf @@ -4,4 +4,4 @@ modules=setup,wsgi,config,exception,gettextutils,importutils,jsonutils,log,xmlutils,sslutils,service,notifier,local,install_venv_common,version,timeutils,eventlet_backdoor,threadgroup,loopingcall,uuidutils # The base module to hold the copy of openstack.common -base=portas \ No newline at end of file +base=glazierapi \ No newline at end of file diff --git a/portas/run_tests.sh b/api/run_tests.sh similarity index 98% rename from portas/run_tests.sh rename to api/run_tests.sh index 31ec4e8e..ec7721b3 100755 --- a/portas/run_tests.sh +++ b/api/run_tests.sh @@ -2,7 +2,7 @@ function usage { echo "Usage: $0 [OPTION]..." - echo "Run Portas's test suite(s)" + echo "Run Glazier API's test suite(s)" echo "" echo " -V, --virtual-env Always use virtualenv. Install automatically if not present" echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment" diff --git a/portas/setup.cfg b/api/setup.cfg similarity index 74% rename from portas/setup.cfg rename to api/setup.cfg index 3e547541..2b3b06e3 100644 --- a/portas/setup.cfg +++ b/api/setup.cfg @@ -9,18 +9,18 @@ tag_date = 0 tag_svn_revision = 0 [compile_catalog] -directory = portas/locale -domain = portas +directory = glazierapi/locale +domain = glazierapi [update_catalog] -domain = portas -output_dir = portas/locale -input_file = portas/locale/portas.pot +domain = glazierapi +output_dir = glazierapi/locale +input_file = glazierapi/locale/glazierapi.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg -output_file = portas/locale/portas.pot +output_file = glazierapi/locale/glazierapi.pot [nosetests] # NOTE(jkoelker) To run the test suite under nose install the following diff --git a/api/setup.py b/api/setup.py new file mode 100644 index 00000000..01d3ce91 --- /dev/null +++ b/api/setup.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# +# Copyright (c) 2013 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import setuptools + +from glazierapi.openstack.common import setup + +requires = setup.parse_requirements() +depend_links = setup.parse_dependency_links() +project = 'glazierapi' + +setuptools.setup( + name=project, + version=setup.get_version(project, '2013.1'), + description='The Glazier Project API', + license='Apache License (2.0)', + author='Mirantis, Inc', + author_email='smelikyan@mirantis.com', + url='http://glazierapi.mirantis.com/', + packages=setuptools.find_packages(exclude=['bin']), + test_suite='nose.collector', + cmdclass=setup.get_cmdclass(), + include_package_data=True, + install_requires=requires, + dependency_links=depend_links, + classifiers=[ + 'Development Status :: 4 - Beta', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Environment :: No Input/Output (Daemon)', + 'Environment :: OpenStack', + ], + scripts=['bin/glazierapi-api'], + py_modules=[] +) diff --git a/portas/tools/install_venv.py b/api/tools/install_venv.py similarity index 89% rename from portas/tools/install_venv.py rename to api/tools/install_venv.py index ccaaa5e8..ecf3c45f 100644 --- a/portas/tools/install_venv.py +++ b/api/tools/install_venv.py @@ -32,12 +32,12 @@ import install_venv_common as install_venv def print_help(): help = """ - Portas development environment setup is complete. + Glazier API development environment setup is complete. - Portas development uses virtualenv to track and manage Python dependencies + Glazier API development uses virtualenv to track and manage Python dependencies while in development and testing. - To activate the Portas virtualenv for the extent of your current shell session + To activate the Glazier API virtualenv for the extent of your current shell session you can run: $ source .venv/bin/activate @@ -58,7 +58,7 @@ def main(argv): pip_requires = os.path.join(root, 'tools', 'pip-requires') test_requires = os.path.join(root, 'tools', 'test-requires') py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) - project = 'Portas' + project = 'glazierapi' install = install_venv.InstallVenv(root, venv, pip_requires, test_requires, py_version, project) options = install.parse_args(argv) diff --git a/portas/tools/install_venv_common.py b/api/tools/install_venv_common.py similarity index 100% rename from portas/tools/install_venv_common.py rename to api/tools/install_venv_common.py diff --git a/portas/tools/pip-requires b/api/tools/pip-requires similarity index 100% rename from portas/tools/pip-requires rename to api/tools/pip-requires diff --git a/portas/tools/test-requires b/api/tools/test-requires similarity index 100% rename from portas/tools/test-requires rename to api/tools/test-requires diff --git a/portas/tools/with_venv.sh b/api/tools/with_venv.sh similarity index 100% rename from portas/tools/with_venv.sh rename to api/tools/with_venv.sh diff --git a/portas/tox.ini b/api/tox.ini similarity index 80% rename from portas/tox.ini rename to api/tox.ini index 24277e9d..47fc9d4d 100644 --- a/portas/tox.ini +++ b/api/tox.ini @@ -14,13 +14,13 @@ commands = nosetests [testenv:pep8] deps = pep8==1.3.3 -commands = pep8 --repeat --show-source portas setup.py +commands = pep8 --repeat --show-source glazierapi setup.py [testenv:venv] commands = {posargs} [testenv:cover] -commands = nosetests --cover-erase --cover-package=portas --with-xcoverage +commands = nosetests --cover-erase --cover-package=glazierapi --with-xcoverage [tox:jenkins] downloadcache = ~/cache/pip @@ -38,7 +38,7 @@ deps = file://{toxinidir}/.cache.bundle [testenv:jenkinscover] deps = file://{toxinidir}/.cache.bundle setenv = NOSE_WITH_XUNIT=1 -commands = nosetests --cover-erase --cover-package=portas --with-xcoverage +commands = nosetests --cover-erase --cover-package=glazierapi --with-xcoverage [testenv:jenkinsvenv] deps = file://{toxinidir}/.cache.bundle diff --git a/portas/README.rst b/portas/README.rst deleted file mode 100644 index 84fe932d..00000000 --- a/portas/README.rst +++ /dev/null @@ -1,7 +0,0 @@ -Keero Portas README -===================== -Portas is a project that provides access to engine via API. - -SEE ALSO --------- -* `Keero `__ diff --git a/portas/portas/common/__init__.py b/portas/portas/common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/portas/portas/common/exception.py b/portas/portas/common/exception.py deleted file mode 100644 index 7f338e8e..00000000 --- a/portas/portas/common/exception.py +++ /dev/null @@ -1,55 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# 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. - -"""Portas exception subclasses""" - -_FATAL_EXCEPTION_FORMAT_ERRORS = False - - -class PortasException(Exception): - """ - Base Portas Exception - - To correctly use this class, inherit from it and define - a 'message' property. That message will get printf'd - with the keyword arguments provided to the constructor. - """ - message = _("An unknown exception occurred") - - def __init__(self, message=None, *args, **kwargs): - if not message: - message = self.message - try: - message = message % kwargs - except Exception as e: - if _FATAL_EXCEPTION_FORMAT_ERRORS: - raise e - else: - # at least get the core message out if something happened - pass - - super(PortasException, self).__init__(message) - - -class SchemaLoadError(PortasException): - message = _("Unable to load schema: %(reason)s") - - -class InvalidObject(PortasException): - message = _("Provided object does not match schema " - "'%(schema)s': %(reason)s") diff --git a/portas/portas/common/uuidutils.py b/portas/portas/common/uuidutils.py deleted file mode 100644 index cf006517..00000000 --- a/portas/portas/common/uuidutils.py +++ /dev/null @@ -1,5 +0,0 @@ -import uuid - - -def generate_uuid(): - return str(uuid.uuid4()).replace('-', '') diff --git a/portas/portas/db/__init__.py b/portas/portas/db/__init__.py deleted file mode 100644 index 2070644b..00000000 --- a/portas/portas/db/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -from oslo.config import cfg - -sql_connection_opt = cfg.StrOpt('sql_connection', - default='sqlite:///portas.sqlite', - secret=True, - metavar='CONNECTION', - help='A valid SQLAlchemy connection ' - 'string for the metadata database. ' - 'Default: %(default)s') - -CONF = cfg.CONF -CONF.register_opt(sql_connection_opt) diff --git a/portas/portas/db/migrate_repo/manage.py b/portas/portas/db/migrate_repo/manage.py deleted file mode 100644 index 67ac41c8..00000000 --- a/portas/portas/db/migrate_repo/manage.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2012 OpenStack, LLC. -# -# 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 migrate.versioning.shell import main - -# This should probably be a console script entry point. -if __name__ == '__main__': - main(debug='False', repository='.') diff --git a/portas/portas/db/migrate_repo/versions/004_add_description_column_to_session.py b/portas/portas/db/migrate_repo/versions/004_add_description_column_to_session.py deleted file mode 100644 index 8e380f2e..00000000 --- a/portas/portas/db/migrate_repo/versions/004_add_description_column_to_session.py +++ /dev/null @@ -1,17 +0,0 @@ -from sqlalchemy.schema import MetaData, Table, Column -from sqlalchemy.types import Text - -meta = MetaData() - - -def upgrade(migrate_engine): - meta.bind = migrate_engine - session = Table('session', meta, autoload=True) - description = Column('description', Text(), nullable=True, default='{}') - description.create(session) - - -def downgrade(migrate_engine): - meta.bind = migrate_engine - session = Table('session', meta, autoload=True) - session.c.description.drop() diff --git a/portas/portas/db/migrate_repo/versions/006_add_entity_id_column_to_status.py b/portas/portas/db/migrate_repo/versions/006_add_entity_id_column_to_status.py deleted file mode 100644 index e96dd7d0..00000000 --- a/portas/portas/db/migrate_repo/versions/006_add_entity_id_column_to_status.py +++ /dev/null @@ -1,17 +0,0 @@ -from sqlalchemy.schema import MetaData, Table, Column -from sqlalchemy.types import String - -meta = MetaData() - - -def upgrade(migrate_engine): - meta.bind = migrate_engine - status = Table('status', meta, autoload=True) - entity_id = Column('entity_id', String(32), nullable=True) - entity_id.create(status) - - -def downgrade(migrate_engine): - meta.bind = migrate_engine - status = Table('status', meta, autoload=True) - status.c.entity_id.drop() diff --git a/portas/portas/db/migrate_repo/versions/__init__.py b/portas/portas/db/migrate_repo/versions/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/portas/portas/openstack/__init__.py b/portas/portas/openstack/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/portas/portas/openstack/common/__init__.py b/portas/portas/openstack/common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/portas/portas/schema.py b/portas/portas/schema.py deleted file mode 100644 index 70517657..00000000 --- a/portas/portas/schema.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2012 OpenStack Foundation. -# All Rights Reserved. -# -# 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 jsonschema - -from portas.common import exception - - -class Schema(object): - - def __init__(self, name, properties=None, links=None): - self.name = name - if properties is None: - properties = {} - self.properties = properties - self.links = links - - def validate(self, obj): - try: - jsonschema.validate(obj, self.raw()) - except jsonschema.ValidationError as e: - raise exception.InvalidObject(schema=self.name, reason=str(e)) - - def filter(self, obj): - filtered = {} - for key, value in obj.iteritems(): - if self._filter_func(self.properties, key) and value is not None: - filtered[key] = value - return filtered - - @staticmethod - def _filter_func(properties, key): - return key in properties - - def raw(self): - raw = { - 'name': self.name, - 'properties': self.properties, - 'additionalProperties': False, - } - if self.links: - raw['links'] = self.links - return raw - - -class CollectionSchema(object): - - def __init__(self, name, item_schema): - self.name = name - self.item_schema = item_schema - - def raw(self): - return { - 'name': self.name, - 'properties': { - self.name: { - 'type': 'array', - 'items': self.item_schema.raw(), - }, - 'first': {'type': 'string'}, - 'next': {'type': 'string'}, - 'schema': {'type': 'string'}, - }, - 'links': [ - {'rel': 'first', 'href': '{first}'}, - {'rel': 'next', 'href': '{next}'}, - {'rel': 'describedby', 'href': '{schema}'}, - ], - } diff --git a/portas/portas/tests/__init__.py b/portas/portas/tests/__init__.py deleted file mode 100644 index e3f3e8d4..00000000 --- a/portas/portas/tests/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2013 Mirantis 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. diff --git a/portas/portas/tests/api/__init__.py b/portas/portas/tests/api/__init__.py deleted file mode 100644 index 1253442e..00000000 --- a/portas/portas/tests/api/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2013 Mirantis 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. -__author__ = 'Mirantis' diff --git a/portas/portas/tests/api/simple_test.py b/portas/portas/tests/api/simple_test.py deleted file mode 100644 index 2fd091d7..00000000 --- a/portas/portas/tests/api/simple_test.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2013 Mirantis Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import portas.api.v1 as api - - -class Test(unittest.TestCase): - def test(self): - assert True diff --git a/portas/portas/utils.py b/portas/portas/utils.py deleted file mode 100644 index 30ae9191..00000000 --- a/portas/portas/utils.py +++ /dev/null @@ -1,24 +0,0 @@ -import functools -import logging -from webob import exc -from portas.db.models import Session -from portas.db.session import get_session - -log = logging.getLogger(__name__) - - -def verify_session(func): - @functools.wraps(func) - def __inner(self, request, *args, **kwargs): - if hasattr(request, 'context') and request.context.session: - uw = get_session().query(Session) - configuration_session = uw.get(request.context.session) - - if configuration_session.state != 'open': - log.info('Session is already deployed') - raise exc.HTTPUnauthorized - else: - log.info('No session is supplied') - raise exc.HTTPUnauthorized - return func(self, request, *args, **kwargs) - return __inner diff --git a/portas/setup.py b/portas/setup.py deleted file mode 100644 index 8cd1b765..00000000 --- a/portas/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/python -# Copyright (c) 2010 OpenStack, LLC. -# -# 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 setuptools - -from portas.openstack.common import setup - -requires = setup.parse_requirements() -depend_links = setup.parse_dependency_links() -project = 'portas' - -setuptools.setup( - name=project, - version=setup.get_version(project, '2013.1'), - description='The Portas project provides a simple WSGI server for Windows ' - 'Environment Management', - license='Apache License (2.0)', - author='OpenStack', - author_email='openstack@lists.launchpad.net', - url='http://portas.openstack.org/', - packages=setuptools.find_packages(exclude=['bin']), - test_suite='nose.collector', - cmdclass=setup.get_cmdclass(), - include_package_data=True, - install_requires=requires, - dependency_links=depend_links, - classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 2.7', - 'Environment :: No Input/Output (Daemon)', - 'Environment :: OpenStack', - ], - scripts=['bin/portas-api'], - py_modules=[] -)