From 362976dde6aeba5e7d033401a6f4ddb4ec413036 Mon Sep 17 00:00:00 2001 From: LiuNanke Date: Tue, 29 Dec 2015 08:51:33 +0800 Subject: [PATCH] Use new log style when LOG.error Use new log style replace the old Logger.exception() in according to the link: http://docs.openstack.org/developer/oslo.log/usage.html Closes-Bug: #1529534 Change-Id: I5aa58bd6fa666c84dc200ecb44ba595f970f0613 --- openstack_dashboard/api/neutron.py | 2 +- .../dashboards/project/instances/workflows/create_instance.py | 4 +++- openstack_dashboard/dashboards/project/stacks/forms.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index 1478a6f85a..9d91bda4d9 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -1091,7 +1091,7 @@ def servers_update_addresses(request, servers, all_tenants=False): ports_floating_ips, network_names) except Exception as e: - LOG.error(e) + LOG.error(six.text_type(e)) else: server.addresses = addresses diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index 46311f1ac0..ab32ddc79f 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -21,6 +21,7 @@ import logging import operator from oslo_utils import units +import six from django.template.defaultfilters import filesizeformat # noqa from django.utils.text import normalize_newlines # noqa @@ -688,7 +689,8 @@ class CustomizeAction(workflows.Action): except Exception as e: msg = _('There was a problem parsing the' ' %(prefix)s: %(error)s') - msg = msg % {'prefix': prefix, 'error': e} + msg = msg % {'prefix': prefix, + 'error': six.text_type(e)} raise forms.ValidationError(msg) return script else: diff --git a/openstack_dashboard/dashboards/project/stacks/forms.py b/openstack_dashboard/dashboards/project/stacks/forms.py index e39636f763..c2878ee54d 100644 --- a/openstack_dashboard/dashboards/project/stacks/forms.py +++ b/openstack_dashboard/dashboards/project/stacks/forms.py @@ -191,7 +191,7 @@ class TemplateForm(forms.SelfHandlingForm): except Exception as e: msg = _('There was a problem parsing the' ' %(prefix)s: %(error)s') - msg = msg % {'prefix': prefix, 'error': e} + msg = msg % {'prefix': prefix, 'error': six.text_type(e)} raise forms.ValidationError(msg) cleaned[data_str] = tpl