From cf115bf8ae8416e8a9added0e8f97c69bb399b73 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Mon, 26 Sep 2011 17:25:50 -0700 Subject: [PATCH] Fixed Bug 849488 -- use log.exception instead of log.error. --- django-openstack/django_openstack/api.py | 8 ++-- .../django_openstack/auth/views.py | 2 +- .../django_openstack/dash/views/containers.py | 2 +- .../dash/views/floating_ips.py | 10 ++--- .../django_openstack/dash/views/images.py | 17 ++++---- .../django_openstack/dash/views/instances.py | 24 +++++------ .../django_openstack/dash/views/keypairs.py | 6 +-- .../dash/views/security_groups.py | 12 +++--- .../django_openstack/dash/views/snapshots.py | 8 ++-- .../django_openstack/decorators.py | 2 +- django-openstack/django_openstack/forms.py | 2 +- .../syspanel/views/flavors.py | 2 +- .../django_openstack/syspanel/views/images.py | 40 ++++++++----------- .../syspanel/views/instances.py | 4 +- .../syspanel/views/services.py | 6 +-- .../syspanel/views/tenants.py | 15 +++---- .../django_openstack/syspanel/views/users.py | 5 +-- 17 files changed, 72 insertions(+), 93 deletions(-) diff --git a/django-openstack/django_openstack/api.py b/django-openstack/django_openstack/api.py index 12000b17d..d54360003 100644 --- a/django-openstack/django_openstack/api.py +++ b/django-openstack/django_openstack/api.py @@ -919,8 +919,7 @@ class GlobalSummary(object): self.service_list = service_list(self.request) except api_exceptions.ApiException, e: self.service_list = [] - LOG.error('ApiException fetching service list in instance usage', - exc_info=True) + LOG.exception('ApiException fetching service list in instance usage') messages.error(self.request, 'Unable to get service info: %s' % e.message) return @@ -944,10 +943,9 @@ class GlobalSummary(object): datetime_end) except api_exceptions.ApiException, e: self.usage_list = [] - LOG.error('ApiException fetching usage list in instance usage' + LOG.exception('ApiException fetching usage list in instance usage' ' on date range "%s to %s"' % (datetime_start, - datetime_end), - exc_info=True) + datetime_end)) messages.error(self.request, 'Unable to get usage info: %s' % e.message) return diff --git a/django-openstack/django_openstack/auth/views.py b/django-openstack/django_openstack/auth/views.py index 28c9d7c8e..e3759b550 100644 --- a/django-openstack/django_openstack/auth/views.py +++ b/django-openstack/django_openstack/auth/views.py @@ -106,7 +106,7 @@ class Login(forms.SelfHandlingForm): except api_exceptions.Unauthorized as e: msg = 'Error authenticating: %s' % e.message - LOG.error(msg, exc_info=True) + LOG.exception(msg) messages.error(request, msg) except api_exceptions.ApiException as e: messages.error(request, 'Error authenticating with keystone: %s' % diff --git a/django-openstack/django_openstack/dash/views/containers.py b/django-openstack/django_openstack/dash/views/containers.py index cf63bccd5..9992ab4e2 100644 --- a/django-openstack/django_openstack/dash/views/containers.py +++ b/django-openstack/django_openstack/dash/views/containers.py @@ -47,7 +47,7 @@ class DeleteContainer(forms.SelfHandlingForm): messages.error(request, 'Unable to delete non-empty container: %s' % \ data['container_name']) - LOG.error('Unable to delete container "%s". Exception: "%s"' % + LOG.exception('Unable to delete container "%s". Exception: "%s"' % (data['container_name'], str(e))) else: messages.info(request, diff --git a/django-openstack/django_openstack/dash/views/floating_ips.py b/django-openstack/django_openstack/dash/views/floating_ips.py index c18f12319..360a79e7a 100644 --- a/django-openstack/django_openstack/dash/views/floating_ips.py +++ b/django-openstack/django_openstack/dash/views/floating_ips.py @@ -46,7 +46,7 @@ class ReleaseFloatingIp(forms.SelfHandlingForm): messages.info(request, 'Successfully released Floating IP: %s' \ % data['floating_ip_id']) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in ReleaseFloatingIp", exc_info=True) + LOG.exception("ClientException in ReleaseFloatingIp") messages.error(request, 'Error releasing Floating IP from tenant: \ %s' % e.message) return shortcuts.redirect(request.build_absolute_uri()) @@ -77,7 +77,7 @@ class FloatingIpAssociate(forms.SelfHandlingForm): % (data['floating_ip'], data['instance_id'])) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in FloatingIpAssociate", exc_info=True) + LOG.exception("ClientException in FloatingIpAssociate") messages.error(request, 'Error associating Floating IP: %s' % e.message) return shortcuts.redirect('dash_floating_ips', request.user.tenant_id) @@ -97,7 +97,7 @@ class FloatingIpDisassociate(forms.SelfHandlingForm): messages.info(request, 'Successfully disassociated Floating IP: %s' % data['floating_ip_id']) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in FloatingIpAssociate", exc_info=True) + LOG.exception("ClientException in FloatingIpAssociate") messages.error(request, 'Error disassociating Floating IP: %s' % e.message) return shortcuts.redirect('dash_floating_ips', request.user.tenant_id) @@ -116,7 +116,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm): to tenant "%s"' % (fip.ip, data['tenant_id'])) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in FloatingIpAllocate", exc_info=True) + LOG.exception("ClientException in FloatingIpAllocate") messages.error(request, 'Error allocating Floating IP "%s"\ to tenant "%s": %s' % (fip.ip, data['tenant_id'], e.message)) @@ -133,7 +133,7 @@ def index(request, tenant_id): floating_ips = api.tenant_floating_ip_list(request) except novaclient_exceptions.ClientException, e: floating_ips = [] - LOG.error("ClientException in floating ip index", exc_info=True) + LOG.exception("ClientException in floating ip index") messages.error(request, 'Error fetching floating ips: %s' % e.message) return shortcuts.render_to_response( diff --git a/django-openstack/django_openstack/dash/views/images.py b/django-openstack/django_openstack/dash/views/images.py index 70e0dddd6..769e64a0f 100644 --- a/django-openstack/django_openstack/dash/views/images.py +++ b/django-openstack/django_openstack/dash/views/images.py @@ -107,8 +107,8 @@ class LaunchForm(forms.SelfHandlingForm): return redirect('dash_instances', tenant_id) except api_exceptions.ApiException, e: - LOG.error('ApiException while creating instances of image "%s"' % - image_id, exc_info=True) + LOG.exception('ApiException while creating instances of image "%s"' % + image_id) messages.error(request, 'Unable to launch instance: %s' % e.message) @@ -129,14 +129,14 @@ def index(request, tenant_id): if not all_images: messages.info(request, "There are currently no images.") except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % str(e)) except glance_exception.Error, e: - LOG.error("Error retrieving image list", exc_info=True) + LOG.exception("Error retrieving image list") messages.error(request, "Error retrieving image list: %s" % str(e)) except api_exceptions.ApiException, e: msg = "Unable to retreive image info from glance: %s" % str(e) - LOG.error(msg) + LOG.exception(msg) messages.error(request, msg) images = [im for im in all_images @@ -160,8 +160,7 @@ def launch(request, tenant_id, image_id): (f.name, f.vcpus, f.disk, f.ram)) for f in fl] return sorted(sel) except api_exceptions.ApiException: - LOG.error('Unable to retrieve list of instance types', - exc_info=True) + LOG.exception('Unable to retrieve list of instance types') return [(1, 'm1.tiny')] def keynamelist(): @@ -170,7 +169,7 @@ def launch(request, tenant_id, image_id): sel = [(f.name, f.name) for f in fl] return sel except api_exceptions.ApiException: - LOG.error('Unable to retrieve list of keypairs', exc_info=True) + LOG.exception('Unable to retrieve list of keypairs') return [] def securitygrouplist(): @@ -179,7 +178,7 @@ def launch(request, tenant_id, image_id): sel = [(f.name, f.name) for f in fl] return sel except novaclient_exceptions.ClientException, e: - LOG.error('Unable to retrieve list of security groups', exc_info=True) + LOG.exception('Unable to retrieve list of security groups') return [] # TODO(mgius): Any reason why these can't be after the launchform logic? diff --git a/django-openstack/django_openstack/dash/views/instances.py b/django-openstack/django_openstack/dash/views/instances.py index 4712f9309..9b9bfd14b 100644 --- a/django-openstack/django_openstack/dash/views/instances.py +++ b/django-openstack/django_openstack/dash/views/instances.py @@ -52,8 +52,8 @@ class TerminateInstance(forms.SelfHandlingForm): try: api.server_delete(request, instance) except api_exceptions.ApiException, e: - LOG.error('ApiException while terminating instance "%s"' % - instance_id, exc_info=True) + LOG.exception('ApiException while terminating instance "%s"' % + instance_id) messages.error(request, 'Unable to terminate %s: %s' % (instance_id, e.message,)) @@ -74,8 +74,8 @@ class RebootInstance(forms.SelfHandlingForm): server = api.server_reboot(request, instance_id) messages.success(request, "Instance rebooting") except api_exceptions.ApiException, e: - LOG.error('ApiException while rebooting instance "%s"' % - instance_id, exc_info=True) + LOG.exception('ApiException while rebooting instance "%s"' % + instance_id) messages.error(request, 'Unable to reboot instance: %s' % e.message) @@ -120,7 +120,7 @@ def index(request, tenant_id): try: instances = api.server_list(request) except api_exceptions.ApiException as e: - LOG.error('Exception in instance index', exc_info=True) + LOG.exception('Exception in instance index') 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 @@ -173,7 +173,7 @@ def usage(request, tenant_id=None): try: usage = api.usage_get(request, tenant_id, datetime_start, datetime_end) except api_exceptions.ApiException, e: - LOG.error('ApiException in instance usage', exc_info=True) + LOG.exception('ApiException in instance usage') messages.error(request, 'Unable to get usage info: %s' % e.message) @@ -231,9 +231,7 @@ def console(request, tenant_id, instance_id): response.flush() return response except api_exceptions.ApiException, e: - LOG.error('ApiException while fetching instance console', - exc_info=True) - + LOG.exception('ApiException while fetching instance console') messages.error(request, 'Unable to get log for instance %s: %s' % (instance_id, e.message)) @@ -248,9 +246,7 @@ def vnc(request, tenant_id, instance_id): return shortcuts.redirect(console.output + ("&title=%s(%s)" % (instance.name, instance_id))) except api_exceptions.ApiException, e: - LOG.error('ApiException while fetching instance vnc connection', - exc_info=True) - + LOG.exception('ApiException while fetching instance vnc connection') messages.error(request, 'Unable to get vnc console for instance %s: %s' % (instance_id, e.message)) @@ -262,9 +258,7 @@ def update(request, tenant_id, instance_id): try: instance = api.server_get(request, instance_id) except api_exceptions.ApiException, e: - LOG.error('ApiException while fetching instance info', - exc_info=True) - + LOG.exception('ApiException while fetching instance info') messages.error(request, 'Unable to get information for instance %s: %s' % (instance_id, e.message)) diff --git a/django-openstack/django_openstack/dash/views/keypairs.py b/django-openstack/django_openstack/dash/views/keypairs.py index 897a066b6..9d5f98c01 100644 --- a/django-openstack/django_openstack/dash/views/keypairs.py +++ b/django-openstack/django_openstack/dash/views/keypairs.py @@ -48,7 +48,7 @@ class DeleteKeypair(forms.SelfHandlingForm): messages.info(request, 'Successfully deleted keypair: %s' \ % data['keypair_id']) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in DeleteKeypair", exc_info=True) + LOG.exception("ClientException in DeleteKeypair") messages.error(request, 'Error deleting keypair: %s' % e.message) return shortcuts.redirect(request.build_absolute_uri()) @@ -68,7 +68,7 @@ class CreateKeypair(forms.SelfHandlingForm): response.write(keypair.private_key) return response except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in CreateKeyPair", exc_info=True) + LOG.exception("ClientException in CreateKeyPair") messages.error(request, 'Error Creating Keypair: %s' % e.message) return shortcuts.redirect(request.build_absolute_uri()) @@ -84,7 +84,7 @@ def index(request, tenant_id): keypairs = api.keypair_list(request) except novaclient_exceptions.ClientException, e: keypairs = [] - LOG.error("ClientException in keypair index", exc_info=True) + LOG.exception("ClientException in keypair index") messages.error(request, 'Error fetching keypairs: %s' % e.message) return shortcuts.render_to_response( diff --git a/django-openstack/django_openstack/dash/views/security_groups.py b/django-openstack/django_openstack/dash/views/security_groups.py index d37736587..d651c26e9 100644 --- a/django-openstack/django_openstack/dash/views/security_groups.py +++ b/django-openstack/django_openstack/dash/views/security_groups.py @@ -58,7 +58,7 @@ class CreateGroup(forms.SelfHandlingForm): return shortcuts.redirect('dash_security_groups', data['tenant_id']) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in CreateGroup", exc_info=True) + LOG.exception("ClientException in CreateGroup") messages.error(request, 'Error creating security group: %s' % e.message) @@ -76,7 +76,7 @@ class DeleteGroup(forms.SelfHandlingForm): messages.info(request, 'Successfully deleted security_group: %s' \ % data['security_group_id']) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in DeleteGroup", exc_info=True) + LOG.exception("ClientException in DeleteGroup") messages.error(request, 'Error deleting security group: %s' % e.message) return shortcuts.redirect('dash_security_groups', data['tenant_id']) @@ -109,7 +109,7 @@ class AddRule(forms.SelfHandlingForm): messages.info(request, 'Successfully added rule: %s' \ % rule.id) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in AddRule", exc_info=True) + LOG.exception("ClientException in AddRule") messages.error(request, 'Error adding rule security group: %s' % e.message) return shortcuts.redirect(request.build_absolute_uri()) @@ -131,7 +131,7 @@ class DeleteRule(forms.SelfHandlingForm): messages.info(request, 'Successfully deleted rule: %s' \ % security_group_rule_id) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in DeleteRule", exc_info=True) + LOG.exception("ClientException in DeleteRule") messages.error(request, 'Error authorizing security group: %s' % e.message) return shortcuts.redirect(request.build_absolute_uri()) @@ -149,7 +149,7 @@ def index(request, tenant_id): security_groups = api.security_group_list(request) except novaclient_exceptions.ClientException, e: security_groups = [] - LOG.error("ClientException in security_groups index", exc_info=True) + LOG.exception("ClientException in security_groups index") messages.error(request, 'Error fetching security_groups: %s' % e.message) @@ -177,7 +177,7 @@ def edit_rules(request, tenant_id, security_group_id): try: security_group = api.security_group_get(request, security_group_id) except novaclient_exceptions.ClientException, e: - LOG.error("ClientException in security_groups rules edit", exc_info=True) + LOG.exception("ClientException in security_groups rules edit") messages.error(request, 'Error getting security_group: %s' % e.message) return shortcuts.redirect('dash_security_groups', tenant_id) diff --git a/django-openstack/django_openstack/dash/views/snapshots.py b/django-openstack/django_openstack/dash/views/snapshots.py index 27096f776..6804862c5 100644 --- a/django-openstack/django_openstack/dash/views/snapshots.py +++ b/django-openstack/django_openstack/dash/views/snapshots.py @@ -63,7 +63,7 @@ class CreateSnapshot(forms.SelfHandlingForm): return shortcuts.redirect('dash_snapshots', data['tenant_id']) except api_exceptions.ApiException, e: msg = 'Error Creating Snapshot: %s' % e.message - LOG.error(msg, exc_info=True) + LOG.exception(msg) messages.error(request, msg) return shortcuts.redirect(request.build_absolute_uri()) @@ -76,11 +76,11 @@ def index(request, tenant_id): images = api.snapshot_list_detailed(request) except glance_exception.ClientConnectionError, e: msg = 'Error connecting to glance: %s' % str(e) - LOG.error(msg, exc_info=True) + LOG.exception(msg) messages.error(request, msg) except glance_exception.Error, e: msg = 'Error retrieving image list: %s' % str(e) - LOG.error(msg, exc_info=True) + LOG.exception(msg) messages.error(request, msg) return render_to_response( @@ -101,7 +101,7 @@ def create(request, tenant_id, instance_id): instance = api.server_get(request, instance_id) except api_exceptions.ApiException, e: msg = "Unable to retreive instance: %s" % str(e) - LOG.error(msg) + LOG.exception(msg) messages.error(request, msg) return shortcuts.redirect('dash_instances', tenant_id) diff --git a/django-openstack/django_openstack/decorators.py b/django-openstack/django_openstack/decorators.py index 80d4cc9c1..a56e819c0 100644 --- a/django-openstack/django_openstack/decorators.py +++ b/django-openstack/django_openstack/decorators.py @@ -37,6 +37,6 @@ def enforce_admin_access(fn): return fn(*args, **kwargs) else: LOG.warn('Redirecting user "%s" from syspanel to dash ( %s )' % - (args[0].user.username, fn.__name__), exc_info=True) + (args[0].user.username, fn.__name__)) return redirect('dash_overview') return dec diff --git a/django-openstack/django_openstack/forms.py b/django-openstack/django_openstack/forms.py index ba15e13ff..58d6ec034 100644 --- a/django-openstack/django_openstack/forms.py +++ b/django-openstack/django_openstack/forms.py @@ -177,7 +177,7 @@ class SelfHandlingForm(Form): return form, form.handle(request, data) except Exception as e: - LOG.error('Nonspecific error while handling form', exc_info=True) + LOG.exception('Nonspecific error while handling form') messages.error(request, 'Unexpected error: %s' % e.message) return form, None diff --git a/django-openstack/django_openstack/syspanel/views/flavors.py b/django-openstack/django_openstack/syspanel/views/flavors.py index 77ec12bed..0d7344bd4 100644 --- a/django-openstack/django_openstack/syspanel/views/flavors.py +++ b/django-openstack/django_openstack/syspanel/views/flavors.py @@ -90,7 +90,7 @@ def index(request): try: flavors = api.flavor_list(request) except api_exceptions.ApiException, e: - LOG.error('ApiException while fetching usage info', exc_info=True) + LOG.exception('ApiException while fetching usage info') messages.error(request, 'Unable to get usage info: %s' % e.message) flavors.sort(key=lambda x: x.id, reverse=True) diff --git a/django-openstack/django_openstack/syspanel/views/images.py b/django-openstack/django_openstack/syspanel/views/images.py index 6b50563d8..d534d9d64 100644 --- a/django-openstack/django_openstack/syspanel/views/images.py +++ b/django-openstack/django_openstack/syspanel/views/images.py @@ -43,12 +43,11 @@ class DeleteImage(forms.SelfHandlingForm): try: api.image_delete(request, image_id) except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error('Error deleting image with id "%s"' % image_id, - exc_info=True) + LOG.exception('Error deleting image with id "%s"' % image_id) messages.error(request, "Error deleting image: %s" % e.message) return redirect(request.build_absolute_uri()) @@ -62,12 +61,11 @@ class ToggleImage(forms.SelfHandlingForm): api.image_update(request, image_id, image_meta={'is_public': False}) except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error('Error updating image with id "%s"' % image_id, - exc_info=True) + LOG.exception('Error updating image with id "%s"' % image_id) messages.error(request, "Error updating image: %s" % e.message) return redirect(request.build_absolute_uri()) @@ -105,10 +103,10 @@ def index(request): if not images: messages.info(request, "There are currently no images.") except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error("Error retrieving image list", exc_info=True) + LOG.exception("Error retrieving image list") messages.error(request, "Error retrieving image list: %s" % e.message) return render_to_response('django_openstack/syspanel/images/index.html', { @@ -124,11 +122,10 @@ def update(request, image_id): try: image = api.image_get(request, image_id) except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error('Error retrieving image with id "%s"' % image_id, - exc_info=True) + LOG.exception('Error retrieving image with id "%s"' % image_id) messages.error(request, "Error retrieving image %s: %s" % (image_id, e.message)) @@ -156,22 +153,19 @@ def update(request, image_id): api.image_update(request, image_id, metadata) messages.success(request, "Image was successfully updated.") except glance_exception.ClientConnectionError, e: - LOG.error("Error connecting to glance", exc_info=True) + LOG.exception("Error connecting to glance") messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error('Error updating image with id "%s"' % image_id, - exc_info=True) + LOG.exception('Error updating image with id "%s"' % image_id) messages.error(request, "Error updating image: %s" % e.message) except: - LOG.error('Unspecified Exception in image update', - exc_info=True) + LOG.exception('Unspecified Exception in image update') messages.error(request, "Image could not be updated, please try again.") return redirect('syspanel_images_update', image_id) else: - LOG.error('Image "%s" failed to update' % image['name'], - exc_info=True) + LOG.exception('Image "%s" failed to update' % image['name']) messages.error(request, "Image could not be uploaded, please try agian.") form = UpdateImageForm(request.POST) @@ -220,17 +214,15 @@ def upload(request): try: api.image_create(request, metadata, image['image_file']) except glance_exception.ClientConnectionError, e: - LOG.error('Error connecting to glance while trying to upload' - ' image', exc_info=True) + LOG.exception('Error connecting to glance while trying to upload' + ' image') messages.error(request, "Error connecting to glance: %s" % e.message) except glance_exception.Error, e: - LOG.error('Glance exception while uploading image', - exc_info=True) + LOG.exception('Glance exception while uploading image') messages.error(request, "Error adding image: %s" % e.message) else: - LOG.error('Image "%s" failed to upload' % image['name'], - exc_info=True) + LOG.exception('Image "%s" failed to upload' % image['name']) messages.error(request, "Image could not be uploaded, please try agian.") form = UploadImageForm(request.POST) diff --git a/django-openstack/django_openstack/syspanel/views/instances.py b/django-openstack/django_openstack/syspanel/views/instances.py index b827254f1..24a2c7ec6 100644 --- a/django-openstack/django_openstack/syspanel/views/instances.py +++ b/django-openstack/django_openstack/syspanel/views/instances.py @@ -139,7 +139,7 @@ def tenant_usage(request, tenant_id): try: usage = api.usage_get(request, tenant_id, datetime_start, datetime_end) except api_exceptions.ApiException, e: - LOG.error('ApiException getting usage info for tenant "%s"' + LOG.exception('ApiException getting usage info for tenant "%s"' ' on date range "%s to %s"' % (tenant_id, datetime_start, datetime_end)) @@ -188,7 +188,7 @@ def index(request): try: instances = api.admin_server_list(request) except Exception as e: - LOG.error('Unspecified error in instance index', exc_info=True) + LOG.exception('Unspecified error in instance index') 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 diff --git a/django-openstack/django_openstack/syspanel/views/services.py b/django-openstack/django_openstack/syspanel/views/services.py index a7b523faf..073c8e344 100644 --- a/django-openstack/django_openstack/syspanel/views/services.py +++ b/django-openstack/django_openstack/syspanel/views/services.py @@ -62,8 +62,8 @@ class ToggleService(forms.SelfHandlingForm): messages.info(request, "Service '%s' has been disabled" % data['name']) except api_exceptions.ApiException, e: - LOG.error('ApiException while toggling service %s' % - data['service'], exc_info=True) + LOG.exception('ApiException while toggling service %s' % + data['service']) messages.error(request, "Unable to update service '%s': %s" % data['name'], e.message) @@ -82,7 +82,7 @@ def index(request): try: services = api.service_list(request) except api_exceptions.ApiException, e: - LOG.error('ApiException fetching service list', exc_info=True) + LOG.exception('ApiException fetching service list') messages.error(request, 'Unable to get service info: %s' % e.message) other_services = [] diff --git a/django-openstack/django_openstack/syspanel/views/tenants.py b/django-openstack/django_openstack/syspanel/views/tenants.py index 271cf1857..d68bf914c 100644 --- a/django-openstack/django_openstack/syspanel/views/tenants.py +++ b/django-openstack/django_openstack/syspanel/views/tenants.py @@ -100,10 +100,9 @@ class CreateTenant(forms.SelfHandlingForm): '%s was successfully created.' % data['name']) except api_exceptions.ApiException, e: - LOG.error('ApiException while creating tenant\n' + LOG.exception('ApiException while creating tenant\n' 'Id: "%s", Description: "%s", Enabled "%s"' % - (data['name'], data['description'], data['enabled']), - exc_info=True) + (data['name'], data['description'], data['enabled'])) messages.error(request, 'Unable to create tenant: %s' % (e.message)) return redirect('syspanel_tenants') @@ -129,11 +128,10 @@ class UpdateTenant(forms.SelfHandlingForm): '%s was successfully updated.' % data['id']) except api_exceptions.ApiException, e: - LOG.error('ApiException while updating tenant\n' + LOG.exception('ApiException while updating tenant\n' 'Id: "%s", Name: "%s", Description: "%s", Enabled "%s"' % (data['id'], data['name'], - data['description'], data['enabled']), - exc_info=True) + data['description'], data['enabled'])) messages.error(request, 'Unable to update tenant: %s' % e.message) return redirect('syspanel_tenants') @@ -180,7 +178,7 @@ def index(request): try: tenants = api.tenant_list(request) except api_exceptions.ApiException, e: - LOG.error('ApiException while getting tenant list', exc_info=True) + LOG.exception('ApiException while getting tenant list') messages.error(request, 'Unable to get tenant info: %s' % e.message) tenants.sort(key=lambda x: x.id, reverse=True) return render_to_response( @@ -217,8 +215,7 @@ def update(request, tenant_id): 'description': tenant.description, 'enabled': tenant.enabled}) except api_exceptions.ApiException, e: - LOG.error('Error fetching tenant with id "%s"' % tenant_id, - exc_info=True) + LOG.exception('Error fetching tenant with id "%s"' % tenant_id) messages.error(request, 'Unable to update tenant: %s' % e.message) return redirect('syspanel_tenants') diff --git a/django-openstack/django_openstack/syspanel/views/users.py b/django-openstack/django_openstack/syspanel/views/users.py index 8f23f20a3..c13703397 100644 --- a/django-openstack/django_openstack/syspanel/views/users.py +++ b/django-openstack/django_openstack/syspanel/views/users.py @@ -208,10 +208,9 @@ def create(request): return redirect('syspanel_users') except api_exceptions.ApiException, e: - LOG.error('ApiException while creating user\n' + LOG.exception('ApiException while creating user\n' 'id: "%s", email: "%s", tenant_id: "%s"' % - (user['id'], user['email'], user['tenant_id']), - exc_info=True) + (user['id'], user['email'], user['tenant_id'])) messages.error(request, 'Error creating user: %s' % e.message)