Files
python-mistralclient/horizon_dashboard/demo_dashboard/dashboards/mistral/api.py
Kirill Izotov 48c9018a1a Add authentication to dashboard
Also:
* fix authentication routine in mistralclient

Change-Id: Ie7e0bd45e3108477b364966b413a474403e5c889
2014-04-30 14:46:40 +07:00

22 lines
816 B
Python

from django.conf import settings
from mistralclient.api import client as mistral_client
SERVICE_TYPE = 'workflow'
def mistralclient(request):
return mistral_client.Client(
username=request.user.username,
auth_token=request.user.token.id,
project_id=request.user.tenant_id,
# Ideally, we should get it from identity endpoint, but since
# python-mistralclient is not supporting v2.0 API it might create
# additional troubles for those who still rely on v2.0 stack-wise.
auth_url=getattr(settings, 'OPENSTACK_KEYSTONE_URL'),
# Todo: add SECONDARY_ENDPOINT_TYPE support
endpoint_type=getattr(settings,
'OPENSTACK_ENDPOINT_TYPE',
'internalURL'),
service_type=SERVICE_TYPE)