some small fixes
This commit is contained in:
parent
ff40d112b1
commit
69880b6d60
@ -1,5 +1,7 @@
|
||||
from django.conf import settings
|
||||
|
||||
import logging
|
||||
|
||||
import glance.client
|
||||
import httplib
|
||||
import json
|
||||
@ -13,10 +15,11 @@ import json
|
||||
def url_for(request, service_name, admin=False):
|
||||
catalog = request.session['serviceCatalog']
|
||||
if admin:
|
||||
return catalog[service_name][0]['adminURL']
|
||||
else:
|
||||
return catalog[service_name][0]['internalURL']
|
||||
|
||||
rv = catalog[service_name][0]['adminURL']
|
||||
else:
|
||||
rv = catalog[service_name][0]['internalURL']
|
||||
return rv
|
||||
|
||||
def compute_api(request):
|
||||
compute = openstack.compute.Compute(auth_token=request.session['token'],
|
||||
management_url=url_for(request, 'nova'))
|
||||
@ -28,21 +31,21 @@ def compute_api(request):
|
||||
def account_api(request):
|
||||
return openstackx.extras.Account(auth_token=request.session['token'],
|
||||
management_url=url_for(request, 'keystone', True))
|
||||
|
||||
|
||||
def glance_api(request):
|
||||
o = urlparse(url_for(request, 'glance'))
|
||||
return glance.client.Client(o.hostname, o.port)
|
||||
|
||||
|
||||
def admin_api(request):
|
||||
return openstackx.admin.Admin(auth_token=request.session['token'],
|
||||
management_url=url_for(request, 'nova', True))
|
||||
|
||||
def extras_api(request):
|
||||
|
||||
def extras_api(request):
|
||||
return openstackx.extras.Extras(auth_token=request.session['token'],
|
||||
management_url=url_for(request, 'nova'))
|
||||
|
||||
|
||||
def auth_api():
|
||||
|
||||
|
||||
def auth_api():
|
||||
return openstackx.auth.Auth(management_url=\
|
||||
settings.OPENSTACK_KEYSTONE_URL)
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
import logging
|
||||
|
||||
from django import http
|
||||
from django import template
|
||||
from django import shortcuts
|
||||
@ -27,6 +29,7 @@ class Login(forms.SelfHandlingForm):
|
||||
request.session['tenant'] = info['tenant']
|
||||
request.session['admin'] = info['admin']
|
||||
request.session['serviceCatalog'] = token.serviceCatalog
|
||||
logging.info(token.serviceCatalog)
|
||||
|
||||
if request.session['admin']:
|
||||
return shortcuts.redirect('syspanel_overview')
|
||||
|
@ -9,7 +9,7 @@ from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import redirect
|
||||
from django.shortcuts import render_to_response
|
||||
import openstackx.compute.exceptions as api_exceptions
|
||||
from openstackx.api import exceptions as api_exceptions
|
||||
|
||||
|
||||
from django_openstack import api
|
||||
|
@ -161,7 +161,6 @@ def index(request):
|
||||
return handled
|
||||
|
||||
instances = api.extras_api(request).servers.list()
|
||||
logging.info('INSTANCES: %s', instances[0].__dict__)
|
||||
|
||||
# We don't have any way of showing errors for these, so don't bother
|
||||
# trying to reuse the forms from above
|
||||
|
Loading…
x
Reference in New Issue
Block a user