Merge pull request #21 from mgius/improve_logging_again_fixed
Totally out of band diff of improve_logging_again
This commit is contained in:
commit
23e928c1e2
@ -15,6 +15,9 @@ from urlparse import urlparse
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.api')
|
||||||
|
|
||||||
|
|
||||||
def url_for(request, service_name, admin=False):
|
def url_for(request, service_name, admin=False):
|
||||||
catalog = request.session['serviceCatalog']
|
catalog = request.session['serviceCatalog']
|
||||||
if admin:
|
if admin:
|
||||||
@ -31,10 +34,17 @@ def compute_api(request):
|
|||||||
# this below hack is necessary to make the jacobian compute client work
|
# this below hack is necessary to make the jacobian compute client work
|
||||||
compute.client.auth_token = request.session['token']
|
compute.client.auth_token = request.session['token']
|
||||||
compute.client.management_url = url_for(request, 'nova')
|
compute.client.management_url = url_for(request, 'nova')
|
||||||
|
LOG.debug('compute_api connection created using token "%s"'
|
||||||
|
' and url "%s"' %
|
||||||
|
(request.session['token'], url_for(request, 'nova')))
|
||||||
return compute
|
return compute
|
||||||
|
|
||||||
|
|
||||||
def account_api(request):
|
def account_api(request):
|
||||||
|
LOG.debug('account_api connection created using token "%s"'
|
||||||
|
' and url "%s"' %
|
||||||
|
(request.session['token'],
|
||||||
|
url_for(request, 'keystone', True)))
|
||||||
return openstackx.extras.Account(
|
return openstackx.extras.Account(
|
||||||
auth_token=request.session['token'],
|
auth_token=request.session['token'],
|
||||||
management_url=url_for(request, 'keystone', True))
|
management_url=url_for(request, 'keystone', True))
|
||||||
@ -42,22 +52,31 @@ def account_api(request):
|
|||||||
|
|
||||||
def glance_api(request):
|
def glance_api(request):
|
||||||
o = urlparse(url_for(request, 'glance'))
|
o = urlparse(url_for(request, 'glance'))
|
||||||
|
LOG.debug('glance_api connection created for host "%s:%d"' %
|
||||||
|
(o.hostname, o.port))
|
||||||
return glance.client.Client(o.hostname, o.port)
|
return glance.client.Client(o.hostname, o.port)
|
||||||
|
|
||||||
|
|
||||||
def admin_api(request):
|
def admin_api(request):
|
||||||
|
LOG.debug('admin_api connection created using token "%s"'
|
||||||
|
' and url "%s"' %
|
||||||
|
(request.session['token'], url_for(request, 'nova', True)))
|
||||||
return openstackx.admin.Admin(auth_token=request.session['token'],
|
return openstackx.admin.Admin(auth_token=request.session['token'],
|
||||||
management_url=url_for(request, 'nova', True))
|
management_url=url_for(request, 'nova', True))
|
||||||
|
|
||||||
|
|
||||||
def extras_api(request):
|
def extras_api(request):
|
||||||
|
LOG.debug('extras_api connection created using token "%s"'
|
||||||
|
' and url "%s"' %
|
||||||
|
(request.session['token'], url_for(request, 'nova')))
|
||||||
return openstackx.extras.Extras(auth_token=request.session['token'],
|
return openstackx.extras.Extras(auth_token=request.session['token'],
|
||||||
management_url=url_for(request, 'nova'))
|
management_url=url_for(request, 'nova'))
|
||||||
|
|
||||||
|
|
||||||
def auth_api():
|
def auth_api():
|
||||||
return openstackx.auth.Auth(management_url=\
|
LOG.debug('auth_api connection created using url "%s"' %
|
||||||
settings.OPENSTACK_KEYSTONE_URL)
|
settings.OPENSTACK_KEYSTONE_URL)
|
||||||
|
return openstackx.auth.Auth(management_url=settings.OPENSTACK_KEYSTONE_URL)
|
||||||
|
|
||||||
|
|
||||||
def console_create(request, instance_id, kind=None):
|
def console_create(request, instance_id, kind=None):
|
||||||
@ -215,6 +234,8 @@ def token_info(request, token):
|
|||||||
|
|
||||||
|
|
||||||
def usage_get(request, tenant_id, start, end):
|
def usage_get(request, tenant_id, start, end):
|
||||||
|
LOG.debug('Usage_get for tenant "%s" from %s to %s"' %
|
||||||
|
(tenant_id, start, end))
|
||||||
return extras_api(request).usage.get(tenant_id, start, end)
|
return extras_api(request).usage.get(tenant_id, start, end)
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ from django_openstack import forms
|
|||||||
from openstackx.api import exceptions as api_exceptions
|
from openstackx.api import exceptions as api_exceptions
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.auth')
|
||||||
|
|
||||||
|
|
||||||
class Login(forms.SelfHandlingForm):
|
class Login(forms.SelfHandlingForm):
|
||||||
username = forms.CharField(max_length="20", label="User Name")
|
username = forms.CharField(max_length="20", label="User Name")
|
||||||
password = forms.CharField(max_length="20", label="Password")
|
password = forms.CharField(max_length="20", label="Password")
|
||||||
@ -28,7 +31,8 @@ class Login(forms.SelfHandlingForm):
|
|||||||
request.session['tenant'] = info['tenant']
|
request.session['tenant'] = info['tenant']
|
||||||
request.session['admin'] = info['admin']
|
request.session['admin'] = info['admin']
|
||||||
request.session['serviceCatalog'] = token.serviceCatalog
|
request.session['serviceCatalog'] = token.serviceCatalog
|
||||||
logging.info(token.serviceCatalog)
|
LOG.info('Login form for user "%s". Service Catalog data:\n%s' %
|
||||||
|
(data['username'], token.serviceCatalog))
|
||||||
|
|
||||||
if request.session['admin']:
|
if request.session['admin']:
|
||||||
return shortcuts.redirect('syspanel_overview')
|
return shortcuts.redirect('syspanel_overview')
|
||||||
@ -36,7 +40,9 @@ class Login(forms.SelfHandlingForm):
|
|||||||
return shortcuts.redirect('dash_overview')
|
return shortcuts.redirect('dash_overview')
|
||||||
|
|
||||||
except api_exceptions.Unauthorized as e:
|
except api_exceptions.Unauthorized as e:
|
||||||
messages.error(request, 'Error authenticating: %s' % e.message)
|
msg = 'Error authenticating: %s' % e.message
|
||||||
|
LOG.error(msg, exc_info=True)
|
||||||
|
messages.error(request, msg)
|
||||||
|
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
|
@ -36,10 +36,11 @@ from django import shortcuts
|
|||||||
from django_openstack import api
|
from django_openstack import api
|
||||||
from django_openstack import forms
|
from django_openstack import forms
|
||||||
from openstackx.api import exceptions as api_exceptions
|
from openstackx.api import exceptions as api_exceptions
|
||||||
|
from glance import client as glance_client
|
||||||
from glance.common import exception as glance_exception
|
from glance.common import exception as glance_exception
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger('django_openstack.dash')
|
LOG = logging.getLogger('django_openstack.dash.views.images')
|
||||||
|
|
||||||
|
|
||||||
class LaunchForm(forms.SelfHandlingForm):
|
class LaunchForm(forms.SelfHandlingForm):
|
||||||
@ -76,11 +77,14 @@ class LaunchForm(forms.SelfHandlingForm):
|
|||||||
user_data=data['user_data'],
|
user_data=data['user_data'],
|
||||||
key_name=data.get('key_name'))
|
key_name=data.get('key_name'))
|
||||||
|
|
||||||
messages.success(request, "Instance was successfully\
|
msg = 'Instance was successfully launched'
|
||||||
launched.")
|
LOG.info(msg)
|
||||||
|
messages.success(request, msg)
|
||||||
return shortcuts.redirect(request.build_absolute_uri())
|
return shortcuts.redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while creating instances of image "%s"' %
|
||||||
|
image_id, exc_info=True)
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Unable to launch instance: %s' % e.message)
|
'Unable to launch instance: %s' % e.message)
|
||||||
|
|
||||||
@ -93,9 +97,11 @@ def index(request, tenant_id):
|
|||||||
all_images = api.image_list_detailed(request)
|
all_images = api.image_list_detailed(request)
|
||||||
if not all_images:
|
if not all_images:
|
||||||
messages.info(request, "There are currently no images.")
|
messages.info(request, "There are currently no images.")
|
||||||
except GlanceClientConnectionError, e:
|
except glance_client.ClientConnectionError, e:
|
||||||
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
messages.error(request, "Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error("Error retrieving image list", exc_info=True)
|
||||||
messages.error(request, "Error retrieving image list: %s" % e.message)
|
messages.error(request, "Error retrieving image list: %s" % e.message)
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
@ -129,6 +135,8 @@ def launch(request, tenant_id, image_id):
|
|||||||
(f.name, f.vcpus, f.disk, f.ram)) for f in fl]
|
(f.name, f.vcpus, f.disk, f.ram)) for f in fl]
|
||||||
return sorted(sel)
|
return sorted(sel)
|
||||||
except:
|
except:
|
||||||
|
LOG.error('Unable to retrieve list of instance types',
|
||||||
|
exc_info=True)
|
||||||
return [(1, 'm1.tiny')]
|
return [(1, 'm1.tiny')]
|
||||||
|
|
||||||
def keynamelist():
|
def keynamelist():
|
||||||
@ -137,6 +145,7 @@ def launch(request, tenant_id, image_id):
|
|||||||
sel = [(f.key_name, f.key_name) for f in fl]
|
sel = [(f.key_name, f.key_name) for f in fl]
|
||||||
return sel
|
return sel
|
||||||
except:
|
except:
|
||||||
|
LOG.error('Unable to retrieve list of keypairs', exc_info=True)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
image = api.image_get(request, image_id)
|
image = api.image_get(request, image_id)
|
||||||
|
@ -49,12 +49,15 @@ class TerminateInstance(forms.SelfHandlingForm):
|
|||||||
try:
|
try:
|
||||||
api.server_delete(request, instance)
|
api.server_delete(request, instance)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while terminating instance "%s"' %
|
||||||
|
instance_id, exc_info=True)
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Unable to terminate %s: %s' %
|
'Unable to terminate %s: %s' %
|
||||||
(instance_id, e.message,))
|
(instance_id, e.message,))
|
||||||
else:
|
else:
|
||||||
messages.success(request,
|
msg = 'Instance %s has been terminated.' % instance_id
|
||||||
'Instance %s has been terminated.' % instance_id)
|
LOG.info(msg)
|
||||||
|
messages.success(request, msg)
|
||||||
|
|
||||||
return redirect(request.build_absolute_uri())
|
return redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
@ -68,9 +71,16 @@ class RebootInstance(forms.SelfHandlingForm):
|
|||||||
server = api.server_reboot(request, instance_id)
|
server = api.server_reboot(request, instance_id)
|
||||||
messages.success(request, "Instance rebooting")
|
messages.success(request, "Instance rebooting")
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while rebooting instance "%s"' %
|
||||||
|
instance_id, exc_info=True)
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Unable to reboot instance: %s' % e.message)
|
'Unable to reboot instance: %s' % e.message)
|
||||||
|
|
||||||
|
else:
|
||||||
|
msg = 'Instance %s has been rebooted.' % instance_id
|
||||||
|
LOG.info(msg)
|
||||||
|
messages.success(request, msg)
|
||||||
|
|
||||||
return redirect(request.build_absolute_uri())
|
return redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +99,9 @@ def index(request, tenant_id):
|
|||||||
# FIXME - ported this over, but it is hacky
|
# FIXME - ported this over, but it is hacky
|
||||||
instance._info['attrs']['image_name'] =\
|
instance._info['attrs']['image_name'] =\
|
||||||
image_dict.get(int(instance.attrs['image_id']), {}).get('name')
|
image_dict.get(int(instance.attrs['image_id']), {}).get('name')
|
||||||
|
# TODO(markgius): Why isn't this an apiexception?
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
LOG.error('Exception in instance index', exc_info=True)
|
||||||
messages.error(request, 'Unable to get instance list: %s' % e.message)
|
messages.error(request, 'Unable to get instance list: %s' % e.message)
|
||||||
|
|
||||||
# We don't have any way of showing errors for these, so don't bother
|
# We don't have any way of showing errors for these, so don't bother
|
||||||
@ -118,6 +130,8 @@ def usage(request, tenant_id=None):
|
|||||||
try:
|
try:
|
||||||
usage = api.usage_get(request, tenant_id, datetime_start, datetime_end)
|
usage = api.usage_get(request, tenant_id, datetime_start, datetime_end)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException in instance usage', exc_info=True)
|
||||||
|
|
||||||
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
||||||
return render_to_response('dash_usage.html', {
|
return render_to_response('dash_usage.html', {
|
||||||
'usage': usage,
|
'usage': usage,
|
||||||
@ -133,6 +147,9 @@ def console(request, tenant_id, instance_id):
|
|||||||
response.flush()
|
response.flush()
|
||||||
return response
|
return response
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while fetching instance console',
|
||||||
|
exc_info=True)
|
||||||
|
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Unable to get log for instance %s: %s' %
|
'Unable to get log for instance %s: %s' %
|
||||||
(instance_id, e.message))
|
(instance_id, e.message))
|
||||||
@ -145,6 +162,9 @@ def vnc(request, tenant_id, instance_id):
|
|||||||
console = api.console_create(request, instance_id, 'vnc')
|
console = api.console_create(request, instance_id, 'vnc')
|
||||||
return redirect(console.output)
|
return redirect(console.output)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while fetching instance vnc connection',
|
||||||
|
exc_info=True)
|
||||||
|
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Unable to get vnc console for instance %s: %s' %
|
'Unable to get vnc console for instance %s: %s' %
|
||||||
(instance_id, e.message))
|
(instance_id, e.message))
|
||||||
|
@ -37,7 +37,7 @@ import openstack.compute.servers
|
|||||||
import openstackx.api.exceptions as api_exceptions
|
import openstackx.api.exceptions as api_exceptions
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger('django_openstack.dash')
|
LOG = logging.getLogger('django_openstack.dash.views.keypairs')
|
||||||
|
|
||||||
|
|
||||||
class DeleteKeypair(forms.SelfHandlingForm):
|
class DeleteKeypair(forms.SelfHandlingForm):
|
||||||
@ -45,18 +45,22 @@ class DeleteKeypair(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
|
LOG.info('Deleting keypair "%s"' % data['keypair_id'])
|
||||||
keypair = api.keypair_delete(request, data['keypair_id'])
|
keypair = api.keypair_delete(request, data['keypair_id'])
|
||||||
messages.info(request, 'Successfully deleted keypair: %s' \
|
messages.info(request, 'Successfully deleted keypair: %s' \
|
||||||
% data['keypair_id'])
|
% data['keypair_id'])
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error("ApiException in DeleteKeypair", exc_info=True)
|
||||||
messages.error(request, 'Error deleting keypair: %s' % e.message)
|
messages.error(request, 'Error deleting keypair: %s' % e.message)
|
||||||
return shortcuts.redirect(request.build_absolute_uri())
|
return shortcuts.redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
|
|
||||||
class CreateKeypair(forms.SelfHandlingForm):
|
class CreateKeypair(forms.SelfHandlingForm):
|
||||||
name = forms.CharField(max_length="20", label="Keypair Name")
|
name = forms.CharField(max_length="20", label="Keypair Name")
|
||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
|
LOG.info('Creating keypair "%s"' % data['name'])
|
||||||
keypair = api.keypair_create(request, data['name'])
|
keypair = api.keypair_create(request, data['name'])
|
||||||
response = http.HttpResponse(mimetype='application/binary')
|
response = http.HttpResponse(mimetype='application/binary')
|
||||||
response['Content-Disposition'] = \
|
response['Content-Disposition'] = \
|
||||||
@ -65,9 +69,11 @@ class CreateKeypair(forms.SelfHandlingForm):
|
|||||||
response.write(keypair.private_key)
|
response.write(keypair.private_key)
|
||||||
return response
|
return response
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error("ApiException in CreateKeyPair", exc_info=True)
|
||||||
messages.error(request, 'Error Creating Keypair: %s' % e.message)
|
messages.error(request, 'Error Creating Keypair: %s' % e.message)
|
||||||
return shortcuts.redirect(request.build_absolute_uri())
|
return shortcuts.redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def index(request, tenant_id):
|
def index(request, tenant_id):
|
||||||
delete_form, handled = DeleteKeypair.maybe_handle(request)
|
delete_form, handled = DeleteKeypair.maybe_handle(request)
|
||||||
@ -78,6 +84,7 @@ def index(request, tenant_id):
|
|||||||
keypairs = api.keypair_list(request)
|
keypairs = api.keypair_list(request)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
keypairs = []
|
keypairs = []
|
||||||
|
LOG.error("ApiException in keypair index", exc_info=True)
|
||||||
messages.error(request, 'Error featching keypairs: %s' % e.message)
|
messages.error(request, 'Error featching keypairs: %s' % e.message)
|
||||||
|
|
||||||
return render_to_response('dash_keypairs.html', {
|
return render_to_response('dash_keypairs.html', {
|
||||||
@ -85,6 +92,7 @@ def index(request, tenant_id):
|
|||||||
'delete_form': delete_form,
|
'delete_form': delete_form,
|
||||||
}, context_instance=template.RequestContext(request))
|
}, context_instance=template.RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def create(request, tenant_id):
|
def create(request, tenant_id):
|
||||||
form, handled = CreateKeypair.maybe_handle(request)
|
form, handled = CreateKeypair.maybe_handle(request)
|
||||||
|
@ -14,7 +14,7 @@ from django.utils import formats
|
|||||||
|
|
||||||
from django.forms import *
|
from django.forms import *
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.forms')
|
||||||
RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
|
RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +132,6 @@ class SelfHandlingForm(Form):
|
|||||||
kwargs['initial'] = initial
|
kwargs['initial'] = initial
|
||||||
super(SelfHandlingForm, self).__init__(*args, **kwargs)
|
super(SelfHandlingForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def maybe_handle(cls, request, *args, **kwargs):
|
def maybe_handle(cls, request, *args, **kwargs):
|
||||||
if cls.__name__ != request.POST.get('method'):
|
if cls.__name__ != request.POST.get('method'):
|
||||||
@ -148,7 +147,7 @@ class SelfHandlingForm(Form):
|
|||||||
|
|
||||||
return form, form.handle(request, data)
|
return form, form.handle(request, data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception('Error while handling form.')
|
LOG.error('Nonspecific error while handling form', exc_info=True)
|
||||||
messages.error(request, 'Unexpected error: %s' % e.message)
|
messages.error(request, 'Unexpected error: %s' % e.message)
|
||||||
return form, None
|
return form, None
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
@ -15,6 +17,8 @@ from openstackx.api import exceptions as api_exceptions
|
|||||||
from django_openstack import api
|
from django_openstack import api
|
||||||
from django_openstack import forms
|
from django_openstack import forms
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.syspanel.views.flavors')
|
||||||
|
|
||||||
|
|
||||||
class CreateFlavor(forms.SelfHandlingForm):
|
class CreateFlavor(forms.SelfHandlingForm):
|
||||||
flavorid = forms.CharField(max_length="10", label="Flavor ID")
|
flavorid = forms.CharField(max_length="10", label="Flavor ID")
|
||||||
@ -30,8 +34,9 @@ class CreateFlavor(forms.SelfHandlingForm):
|
|||||||
int(data['vcpus']),
|
int(data['vcpus']),
|
||||||
int(data['disk_gb']),
|
int(data['disk_gb']),
|
||||||
int(data['flavorid']))
|
int(data['flavorid']))
|
||||||
messages.success(request,
|
msg = '%s was successfully added to flavors.' % data['name']
|
||||||
'%s was successfully added to flavors.' % data['name'])
|
LOG.info(msg)
|
||||||
|
messages.success(request, msg)
|
||||||
return redirect('syspanel_flavors')
|
return redirect('syspanel_flavors')
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +45,7 @@ class DeleteFlavor(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
flavor_id = data['flavorid']
|
flavor_id = data['flavorid']
|
||||||
|
LOG.info('Deleting flavor with id "%s"' % flavor_id)
|
||||||
api.flavor_delete(flavor_id, True)
|
api.flavor_delete(flavor_id, True)
|
||||||
return redirect(request.build_absolute_uri())
|
return redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
@ -59,6 +65,7 @@ def index(request):
|
|||||||
try:
|
try:
|
||||||
flavors = api.flavor_list_admin(request)
|
flavors = api.flavor_list_admin(request)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while fetching usage info', exc_info=True)
|
||||||
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
||||||
|
|
||||||
flavors.sort(key=lambda x: x.id, reverse=True)
|
flavors.sort(key=lambda x: x.id, reverse=True)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django import http
|
from django import http
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -14,6 +16,9 @@ from django_openstack import api
|
|||||||
from django_openstack import forms
|
from django_openstack import forms
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.sysadmin.views.images')
|
||||||
|
|
||||||
|
|
||||||
class DeleteImage(forms.SelfHandlingForm):
|
class DeleteImage(forms.SelfHandlingForm):
|
||||||
image_id = forms.CharField(required=True)
|
image_id = forms.CharField(required=True)
|
||||||
|
|
||||||
@ -22,8 +27,12 @@ class DeleteImage(forms.SelfHandlingForm):
|
|||||||
try:
|
try:
|
||||||
api.image_delete(request, image_id)
|
api.image_delete(request, image_id)
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error('Error deleting image with id "%s"' % image_id,
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, "Error deleting image: %s" % e.message)
|
messages.error(request, "Error deleting image: %s" % e.message)
|
||||||
return redirect(request.build_absolute_uri())
|
return redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
@ -36,13 +45,16 @@ class ToggleImage(forms.SelfHandlingForm):
|
|||||||
try:
|
try:
|
||||||
api.image_update(request, image_id, image_meta={'is_public': False})
|
api.image_update(request, image_id, image_meta={'is_public': False})
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error('Error updating image with id "%s"' % image_id,
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, "Error updating image: %s" % e.message)
|
messages.error(request, "Error updating image: %s" % e.message)
|
||||||
return redirect(request.build_absolute_uri())
|
return redirect(request.build_absolute_uri())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
for f in (DeleteImage, ToggleImage):
|
for f in (DeleteImage, ToggleImage):
|
||||||
@ -61,8 +73,10 @@ def index(request):
|
|||||||
if not images:
|
if not images:
|
||||||
messages.info(request, "There are currently no images.")
|
messages.info(request, "There are currently no images.")
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
messages.error(request, "Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error("Error retrieving image list", exc_info=True)
|
||||||
messages.error(request, "Error retrieving image list: %s" % e.message)
|
messages.error(request, "Error retrieving image list: %s" % e.message)
|
||||||
|
|
||||||
return render_to_response('syspanel_images.html', {
|
return render_to_response('syspanel_images.html', {
|
||||||
@ -77,9 +91,13 @@ def update(request, image_id):
|
|||||||
try:
|
try:
|
||||||
image = api.image_get(request, image_id)
|
image = api.image_get(request, image_id)
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
messages.error(request, "Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
messages.error(request, "Error retrieving image %s: %s" % (image_id, e.message))
|
LOG.error('Error retrieving image with id "%s"' % image_id,
|
||||||
|
exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Error retrieving image %s: %s" % (image_id, e.message))
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = UpdateImageForm(request.POST)
|
form = UpdateImageForm(request.POST)
|
||||||
@ -104,15 +122,24 @@ def update(request, image_id):
|
|||||||
api.image_update(request, image_id, metadata)
|
api.image_update(request, image_id, metadata)
|
||||||
messages.success(request, "Image was successfully updated.")
|
messages.success(request, "Image was successfully updated.")
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
LOG.error("Error connecting to glance", exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error('Error updating image with id "%s"' % image_id,
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, "Error updating image: %s" % e.message)
|
messages.error(request, "Error updating image: %s" % e.message)
|
||||||
except:
|
except:
|
||||||
messages.error(request, "Image could not be updated, please try again.")
|
LOG.error('Unspecified Exception in image update',
|
||||||
|
exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Image could not be updated, please try again.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
messages.error(request, "Image could not be uploaded, please try agian.")
|
LOG.error('Image "%s" failed to update' % image['name'],
|
||||||
|
exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Image could not be uploaded, please try agian.")
|
||||||
form = UpdateImageForm(request.POST)
|
form = UpdateImageForm(request.POST)
|
||||||
return render_to_response('django_nova_syspanel/images/image_update.html',{
|
return render_to_response('django_nova_syspanel/images/image_update.html',{
|
||||||
'image': image,
|
'image': image,
|
||||||
@ -139,6 +166,7 @@ def update(request, image_id):
|
|||||||
'form': form,
|
'form': form,
|
||||||
}, context_instance = template.RequestContext(request))
|
}, context_instance = template.RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def upload(request):
|
def upload(request):
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
@ -158,11 +186,19 @@ def upload(request):
|
|||||||
try:
|
try:
|
||||||
api.image_create(request, metadata, image['image_file'])
|
api.image_create(request, metadata, image['image_file'])
|
||||||
except GlanceClientConnectionError, e:
|
except GlanceClientConnectionError, e:
|
||||||
messages.error(request, "Error connecting to glance: %s" % e.message)
|
LOG.error('Error connecting to glance while trying to upload'
|
||||||
|
' image', exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Error connecting to glance: %s" % e.message)
|
||||||
except glance_exception.Error, e:
|
except glance_exception.Error, e:
|
||||||
|
LOG.error('Glance exception while uploading image',
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, "Error adding image: %s" % e.message)
|
messages.error(request, "Error adding image: %s" % e.message)
|
||||||
else:
|
else:
|
||||||
messages.error(request, "Image could not be uploaded, please try agian.")
|
LOG.error('Image "%s" failed to upload' % image['name'],
|
||||||
|
exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
"Image could not be uploaded, please try agian.")
|
||||||
form = UploadImageForm(request.POST)
|
form = UploadImageForm(request.POST)
|
||||||
return render_to_response('django_nova_syspanel/images/image_upload.html',{
|
return render_to_response('django_nova_syspanel/images/image_upload.html',{
|
||||||
'form': form,
|
'form': form,
|
||||||
|
@ -21,6 +21,8 @@ from openstackx.api import exceptions as api_exceptions
|
|||||||
TerminateInstance = dash_instances.TerminateInstance
|
TerminateInstance = dash_instances.TerminateInstance
|
||||||
RebootInstance = dash_instances.RebootInstance
|
RebootInstance = dash_instances.RebootInstance
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.syspanel.views.instances')
|
||||||
|
|
||||||
|
|
||||||
def _next_month(date_start):
|
def _next_month(date_start):
|
||||||
y = date_start.year + (date_start.month + 1)/13
|
y = date_start.year + (date_start.month + 1)/13
|
||||||
@ -63,7 +65,10 @@ def usage(request):
|
|||||||
try:
|
try:
|
||||||
service_list = api.service_list(request)
|
service_list = api.service_list(request)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
messages.error(request, 'Unable to get service info: %s' % e.message)
|
LOG.error('ApiException fetching service list in instance usage',
|
||||||
|
exc_info=True)
|
||||||
|
messages.error(request,
|
||||||
|
'Unable to get service info: %s' % e.message)
|
||||||
|
|
||||||
for service in service_list:
|
for service in service_list:
|
||||||
if service.type == 'nova-compute':
|
if service.type == 'nova-compute':
|
||||||
@ -73,6 +78,10 @@ def usage(request):
|
|||||||
try:
|
try:
|
||||||
usage_list = api.usage_list(request, datetime_start, datetime_end)
|
usage_list = api.usage_list(request, datetime_start, datetime_end)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException fetching usage list in instance usage'
|
||||||
|
' on date range "%s to %s"' % (datetime_start,
|
||||||
|
datetime_end),
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
||||||
|
|
||||||
dateform = forms.DateForm()
|
dateform = forms.DateForm()
|
||||||
@ -144,6 +153,10 @@ def tenant_usage(request, tenant_id):
|
|||||||
try:
|
try:
|
||||||
usage = api.usage_get(request, tenant_id, datetime_start, datetime_end)
|
usage = api.usage_get(request, tenant_id, datetime_start, datetime_end)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException getting usage info for tenant "%s"'
|
||||||
|
' on date range "%s to %s"' % (tenant_id,
|
||||||
|
datetime_start,
|
||||||
|
datetime_end))
|
||||||
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
messages.error(request, 'Unable to get usage info: %s' % e.message)
|
||||||
|
|
||||||
return render_to_response(
|
return render_to_response(
|
||||||
@ -169,6 +182,7 @@ def index(request):
|
|||||||
instance._info['attrs']['image_name'] =\
|
instance._info['attrs']['image_name'] =\
|
||||||
image_dict.get(int(instance.attrs['image_id']),{}).get('name')
|
image_dict.get(int(instance.attrs['image_id']),{}).get('name')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
LOG.error('Unspecified error in instance index', exc_info=True)
|
||||||
messages.error(request, 'Unable to get instance list: %s' % e.message)
|
messages.error(request, 'Unable to get instance list: %s' % e.message)
|
||||||
|
|
||||||
# We don't have any way of showing errors for these, so don't bother
|
# We don't have any way of showing errors for these, so don't bother
|
||||||
|
@ -12,6 +12,7 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@ -21,6 +22,8 @@ from django_openstack import forms
|
|||||||
from django_openstack.dash.views import instances as dash_instances
|
from django_openstack.dash.views import instances as dash_instances
|
||||||
from openstackx.api import exceptions as api_exceptions
|
from openstackx.api import exceptions as api_exceptions
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.syspanel.views.services')
|
||||||
|
|
||||||
|
|
||||||
class ToggleService(forms.SelfHandlingForm):
|
class ToggleService(forms.SelfHandlingForm):
|
||||||
service = forms.CharField(required=False)
|
service = forms.CharField(required=False)
|
||||||
@ -39,6 +42,8 @@ class ToggleService(forms.SelfHandlingForm):
|
|||||||
messages.info(request, "Service '%s' has been disabled"
|
messages.info(request, "Service '%s' has been disabled"
|
||||||
% data['name'])
|
% data['name'])
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while toggling service %s' %
|
||||||
|
data['service'], exc_info=True)
|
||||||
messages.error(request, "Unable to update service '%s': %s"
|
messages.error(request, "Unable to update service '%s': %s"
|
||||||
% data['name'], e.message)
|
% data['name'], e.message)
|
||||||
|
|
||||||
@ -56,6 +61,7 @@ def index(request):
|
|||||||
try:
|
try:
|
||||||
services = api.service_list(request)
|
services = api.service_list(request)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException fetching service list', exc_info=True)
|
||||||
messages.error(request, 'Unable to get service info: %s' % e.message)
|
messages.error(request, 'Unable to get service info: %s' % e.message)
|
||||||
|
|
||||||
other_services = []
|
other_services = []
|
||||||
@ -63,7 +69,11 @@ def index(request):
|
|||||||
for k, v in request.session['serviceCatalog'].iteritems():
|
for k, v in request.session['serviceCatalog'].iteritems():
|
||||||
v = v[0]
|
v = v[0]
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['curl', '-m', '1', v['internalURL']])
|
# TODO(mgius): This silences curl, but there's probably
|
||||||
|
# a better solution than using curl to begin with
|
||||||
|
subprocess.check_call(['curl', '-m', '1', v['internalURL']],
|
||||||
|
stdout=open(sys.devnull, 'w'),
|
||||||
|
stderr=open(sys.devnull, 'w'))
|
||||||
up = True
|
up = True
|
||||||
except:
|
except:
|
||||||
up = False
|
up = False
|
||||||
|
@ -20,6 +20,9 @@ from django_openstack.dash.views import instances as dash_instances
|
|||||||
from openstackx.api import exceptions as api_exceptions
|
from openstackx.api import exceptions as api_exceptions
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.syspanel.views.tenants')
|
||||||
|
|
||||||
|
|
||||||
class CreateTenant(forms.SelfHandlingForm):
|
class CreateTenant(forms.SelfHandlingForm):
|
||||||
id = forms.CharField(label="ID (name)")
|
id = forms.CharField(label="ID (name)")
|
||||||
description = forms.CharField(widget=forms.widgets.Textarea(), label="Description")
|
description = forms.CharField(widget=forms.widgets.Textarea(), label="Description")
|
||||||
@ -27,6 +30,7 @@ class CreateTenant(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
|
LOG.info('Creating tenant with id "%s"' % data['id'])
|
||||||
api.tenant_create(request,
|
api.tenant_create(request,
|
||||||
data['id'],
|
data['id'],
|
||||||
data['description'],
|
data['description'],
|
||||||
@ -35,6 +39,10 @@ class CreateTenant(forms.SelfHandlingForm):
|
|||||||
'%s was successfully created.'
|
'%s was successfully created.'
|
||||||
% data['id'])
|
% data['id'])
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while creating tenant\n'
|
||||||
|
'Id: "%s", Description: "%s", Enabled "%s"' %
|
||||||
|
(data['id'], data['description'], data['enabled']),
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, 'Unable to create tenant: %s' %
|
messages.error(request, 'Unable to create tenant: %s' %
|
||||||
(e.message))
|
(e.message))
|
||||||
return redirect('syspanel_tenants')
|
return redirect('syspanel_tenants')
|
||||||
@ -47,6 +55,7 @@ class UpdateTenant(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
|
LOG.info('Updating tenant with id "%s"' % data['id'])
|
||||||
api.tenant_update(request,
|
api.tenant_update(request,
|
||||||
data['id'],
|
data['id'],
|
||||||
data['description'],
|
data['description'],
|
||||||
@ -55,6 +64,10 @@ class UpdateTenant(forms.SelfHandlingForm):
|
|||||||
'%s was successfully updated.'
|
'%s was successfully updated.'
|
||||||
% data['id'])
|
% data['id'])
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while updating tenant\n'
|
||||||
|
'Id: "%s", Description: "%s", Enabled "%s"' %
|
||||||
|
(data['id'], data['description'], data['enabled']),
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
||||||
return redirect('syspanel_tenants')
|
return redirect('syspanel_tenants')
|
||||||
|
|
||||||
@ -65,6 +78,7 @@ def index(request):
|
|||||||
try:
|
try:
|
||||||
tenants = api.tenant_list(request)
|
tenants = api.tenant_list(request)
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while getting tenant list', exc_info=True)
|
||||||
messages.error(request, 'Unable to get tenant info: %s' % e.message)
|
messages.error(request, 'Unable to get tenant info: %s' % e.message)
|
||||||
tenants.sort(key=lambda x: x.id, reverse=True)
|
tenants.sort(key=lambda x: x.id, reverse=True)
|
||||||
return render_to_response('syspanel_tenants.html',{
|
return render_to_response('syspanel_tenants.html',{
|
||||||
@ -97,6 +111,8 @@ def update(request, tenant_id):
|
|||||||
'description': tenant.description,
|
'description': tenant.description,
|
||||||
'enabled': tenant.enabled})
|
'enabled': tenant.enabled})
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('Error fetching tenant with id "%s"' % tenant_id,
|
||||||
|
exc_info=True)
|
||||||
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
||||||
return redirect('syspanel_tenants')
|
return redirect('syspanel_tenants')
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ from django_openstack.dash.views import instances as dash_instances
|
|||||||
from openstackx.api import exceptions as api_exceptions
|
from openstackx.api import exceptions as api_exceptions
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger('django_openstack.syspanel.views.users')
|
||||||
|
|
||||||
|
|
||||||
class UserForm(forms.Form):
|
class UserForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -38,6 +40,7 @@ class UserDeleteForm(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
user_id = data['user']
|
user_id = data['user']
|
||||||
|
LOG.info('Deleting user with id "%s"' % user_id)
|
||||||
api.user_delete(request, user_id)
|
api.user_delete(request, user_id)
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
'%s was successfully deleted.'
|
'%s was successfully deleted.'
|
||||||
@ -127,6 +130,7 @@ def create(request):
|
|||||||
user = form.clean()
|
user = form.clean()
|
||||||
# TODO Make this a real request
|
# TODO Make this a real request
|
||||||
try:
|
try:
|
||||||
|
LOG.info('Creating user with id "%s"' % user['id'])
|
||||||
api.user_create(request,
|
api.user_create(request,
|
||||||
user['id'],
|
user['id'],
|
||||||
user['email'],
|
user['email'],
|
||||||
@ -140,6 +144,10 @@ def create(request):
|
|||||||
return redirect('syspanel_users')
|
return redirect('syspanel_users')
|
||||||
|
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
|
LOG.error('ApiException while creating user\n'
|
||||||
|
'id: "%s", email: "%s", tenant_id: "%s"' %
|
||||||
|
(user['id'], user['email'], user['tenant_id']),
|
||||||
|
exc_info=True)
|
||||||
messages.error(request,
|
messages.error(request,
|
||||||
'Error creating user: %s'
|
'Error creating user: %s'
|
||||||
% e.message)
|
% e.message)
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import traceback
|
|
||||||
|
|
||||||
LOG = logging.getLogger('openstack_dashboard')
|
LOG = logging.getLogger('openstack_dashboard')
|
||||||
|
|
||||||
|
|
||||||
class DashboardLogUnhandledExceptionsMiddleware(object):
|
class DashboardLogUnhandledExceptionsMiddleware(object):
|
||||||
def process_exception(self, request, exception):
|
def process_exception(self, request, exception):
|
||||||
tb_text = traceback.format_exc()
|
LOG.critical('Unhandled Exception in of type "%s" in dashboard.'
|
||||||
LOG.critical('Unhandled Exception in dashboard. Exception "%s"'
|
% type(exception), exc_info=True)
|
||||||
'\n%s' % (str(exception), tb_text))
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
"""
|
"""
|
||||||
Views for home page.
|
Views for home page.
|
||||||
"""
|
"""
|
||||||
import logging
|
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django import shortcuts
|
from django import shortcuts
|
||||||
from django.views.decorators import vary
|
from django.views.decorators import vary
|
||||||
@ -28,6 +26,7 @@ from django.views.decorators import vary
|
|||||||
from django_openstack import api
|
from django_openstack import api
|
||||||
from django_openstack.auth import views as auth_views
|
from django_openstack.auth import views as auth_views
|
||||||
|
|
||||||
|
|
||||||
@vary.vary_on_cookie
|
@vary.vary_on_cookie
|
||||||
def splash(request):
|
def splash(request):
|
||||||
if request.user:
|
if request.user:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user