Added the support of Glance Artifact Repository
Murano's application packages can now be stored either in database (using murano-api) or in Glance Artifact repository (so-called Glance V3 api). This patch adds an experimental support of the latter approach to murano dashboard. As all the difference between these two storages is incapsulated in the murano client, dashboard just needs to configure it properly by passing an instance of glance v3 client on creation. This is controlled by the presence of MURANO_USE_GLARE setting in local_settings.py. If it exists and is True, muranoclient will store the packages in Glance. The old mode will be used otherwise. This patch also adds a "Version" column to the "Package Definitions" view to display the version of each package. The values are set only if Artifacts-based storage s in use; the column is populated by dashes otherwise. Implements-blueprint: artifact-repository-support Depends-on: I35d71bb7c03b23b01722e060c3ef770a24168ada Change-Id: I7f77650436ce4c4845ccbbbabf58872a41d3c14c
This commit is contained in:
parent
059e65280d
commit
319576d587
|
@ -21,9 +21,11 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from horizon import exceptions
|
||||
import muranoclient.client as client
|
||||
from muranoclient.common import exceptions as exc
|
||||
from muranoclient.glance import client as art_client
|
||||
from openstack_dashboard.api import base
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
||||
from muranodashboard.common import utils as muranodashboard_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -97,13 +99,41 @@ def _get_endpoint(request):
|
|||
return endpoint
|
||||
|
||||
|
||||
def _get_glance_endpoint(request):
|
||||
endpoint = getattr(settings, 'GLANCE_API_URL', None)
|
||||
if not endpoint:
|
||||
try:
|
||||
endpoint = base.url_for(request, "image")
|
||||
except exceptions.ServiceCatalogException:
|
||||
endpoint = 'http://localhost:9292'
|
||||
LOG.warning('Glance API location could not be found in Service '
|
||||
'Catalog, using default: {0}'.format(endpoint))
|
||||
return endpoint
|
||||
|
||||
|
||||
def artifactclient(request):
|
||||
endpoint = _get_glance_endpoint(request)
|
||||
insecure = getattr(settings, 'GLANCE_API_INSECURE', False)
|
||||
token_id = request.user.token.id
|
||||
return art_client.Client(endpoint=endpoint, token=token_id,
|
||||
insecure=insecure, type_name='murano',
|
||||
type_version=1)
|
||||
|
||||
|
||||
def muranoclient(request):
|
||||
endpoint = _get_endpoint(request)
|
||||
insecure = getattr(settings, 'MURANO_API_INSECURE', False)
|
||||
|
||||
use_artifacts = getattr(settings, 'MURANO_USE_GLARE', False)
|
||||
if use_artifacts:
|
||||
artifacts = artifactclient(request)
|
||||
else:
|
||||
artifacts = None
|
||||
|
||||
token_id = request.user.token.id
|
||||
LOG.debug('Murano::Client <Url: {0}, '
|
||||
'TokenId: {1}>'.format(endpoint, token_id))
|
||||
|
||||
return client.Client(1, endpoint=endpoint, token=token_id,
|
||||
insecure=insecure)
|
||||
insecure=insecure, artifacts_client=artifacts,
|
||||
tenant=request.user.tenant_id)
|
||||
|
|
|
@ -9,6 +9,13 @@ TEMPLATE_DEBUG = DEBUG
|
|||
DEBUG_PROPAGATE_EXCEPTIONS = True
|
||||
MURANO_API_URL = "http://localhost:8082"
|
||||
|
||||
# Set to True to use Glance Artifact Repository to store murano packages
|
||||
MURANO_USE_GLARE = False
|
||||
|
||||
# Sets the Glance API endpoint to interact with Artifact Repo.
|
||||
# If left commented the one from keystone will be used
|
||||
# GLANCE_API_URL = 'http://ubuntu1:9292'
|
||||
|
||||
# Required for Django 1.5.
|
||||
# If horizon is running in production (DEBUG is False), set this
|
||||
# with the list of host/domain names that the application can serve.
|
||||
|
|
|
@ -198,6 +198,7 @@ class PackageDefinitionsTable(tables.DataTable):
|
|||
is_public = tables.Column('is_public', verbose_name=_('Public'))
|
||||
type = tables.Column('type', verbose_name=_('Type'))
|
||||
author = tables.Column('author', verbose_name=_('Author'))
|
||||
version = tables.Column('version', verbose_name=_('Version'))
|
||||
owner = tables.Column('owner_id',
|
||||
verbose_name=_('Owner'),
|
||||
hidden=True)
|
||||
|
|
Loading…
Reference in New Issue