Initial stab at pbr and version passing.

This patch updates the build system to use pbr. It also
passes the Horizon and App Catalog UI plugin versions
to the application repository as part of the ajax request
so we can more easily determine when v1 api support can
be removed in the future.

Change-Id: Ic407d45a09b00d97ff7492b6597693524522153d
This commit is contained in:
Kevin Fox 2015-08-31 15:01:38 -07:00
parent 60b8f3ada0
commit e9713076f5
7 changed files with 70 additions and 47 deletions

View File

@ -26,7 +26,13 @@ How to try this package
../horizon/tools/with_venv.sh pip install --upgrade .
cp -a enabled/* ../horizon/openstack_dashboard/enabled/
popd
./run_tests.sh --runserver 127.0.0.1:18000
* For Murano support, you need to patch the murano-dashboard plugin with:
https://review.openstack.org/#/c/217747/
#FOR Murano Dashboard support:
git clone http://github.com/openstack/murano-dashboard.git
pushd ../murano-dashboard
../horizon/tools/with_venv.sh pip install --upgrade .
cp muranodashboard/local/_50_murano.py ../horizon/openstack_dashboard/enabled/
popd
#Start test server
./run_tests.sh --runserver 127.0.0.1:18000

View File

@ -168,7 +168,15 @@
var app_catalog_url = app_catalog_settings.APP_CATALOG_URL;
var req = {
url: app_catalog_url + '/api/v1/assets',
headers: {'X-Requested-With': undefined}
headers: {
'X-Requested-With': undefined,
'X-App-Catalog-Versions': [
app_catalog_settings.HORIZON_VERSION.VER,
app_catalog_settings.HORIZON_VERSION.REL,
app_catalog_settings.APP_CATALOG_VERSION.VER,
app_catalog_settings.APP_CATALOG_VERSION.REL
].join(' ')
}
};
$http(req).success(function(data) {
if('deprecated' in data) {

15
app_catalog/version.py Normal file
View File

@ -0,0 +1,15 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
version_info = pbr.version.VersionInfo('app_catalog_ui')

View File

@ -1,5 +1,7 @@
from horizon import Horizon
from horizon import views
from horizon.version import version_info as hvi
from app_catalog.version import version_info as acvi
from django.conf import settings
import json
@ -17,6 +19,14 @@ class IndexView(views.APIView):
pass
app_catalog_settings = {
'HAS_MURANO': has_murano,
'HORIZON_VERSION': {
'VER': hvi.version_string(),
'REL': hvi.release_string()
},
'APP_CATALOG_VERSION': {
'VER': acvi.version_string(),
'REL': acvi.release_string()
},
'APP_CATALOG_URL': getattr(settings, 'APP_CATALOG_URL', 'http://apps.openstack.org')
}
context['APP_CATALOG_SETTINGS'] = json.dumps(app_catalog_settings)

View File

@ -1,24 +1,6 @@
from horizon import Horizon
from horizon import views
from django.conf import settings
from app_catalog.views import IndexView as ACView
import json
class IndexView(views.APIView):
class IndexView(ACView):
# A very simple class-based view...
template_name = 'component_catalog/index.html'
def get_data(self, request, context, *args, **kwargs):
has_murano = False
try:
Horizon.get_dashboard('murano')
has_murano = True
except:
pass
app_catalog_settings = {
'HAS_MURANO': has_murano,
'APP_CATALOG_URL': getattr(settings, 'APP_CATALOG_URL', 'http://apps.openstack.org')
}
context['APP_CATALOG_SETTINGS'] = json.dumps(app_catalog_settings)
return context

View File

@ -1,2 +1,24 @@
[metadata]
name = app-catalog-ui
description = 'OpenStack Application Catalog for OpenStack Dashboard',
author = OpenStack Foundation
author_email = openstack-dev@lists.openstack.org
description-file = README.rst
classifier =
Development Status :: 4 - Beta
Environment :: OpenStack
Framework :: Django
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: Information Technology
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Topic :: Internet :: WWW/HTTP
[files]
packages =
app_catalog
component_catalog

View File

@ -13,29 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
from setuptools import setup
setup(
name = 'app-catalog-ui',
version = '0.0.1',
description = 'OpenStack Application Catalog for OpenStack Dashboard',
author = 'Kevin Fox',
author_email = 'kevin@efox.cc',
classifiers = [
'Environment :: OpenStack',
'Framework :: Django',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
],
packages=['app_catalog', 'component_catalog'],
include_package_data = True,
setup_requires=['pbr'],
pbr=True,
)