diff --git a/senlin_dashboard/cluster/clusters/forms.py b/senlin_dashboard/cluster/clusters/forms.py index 7ef625dc..fde657e2 100644 --- a/senlin_dashboard/cluster/clusters/forms.py +++ b/senlin_dashboard/cluster/clusters/forms.py @@ -87,10 +87,10 @@ class CreateForm(forms.SelfHandlingForm): msg = _('Creating cluster "%s" successfully') % data['name'] messages.success(request, msg) return cluster - except Exception: + except Exception as e: redirect = reverse(INDEX_URL) exceptions.handle(request, - _("Unable to create cluster."), + _("Unable to create cluster: %s") % e, redirect=redirect) @@ -125,8 +125,8 @@ class ManagePoliciesForm(forms.SelfHandlingForm): "cluster": data['cluster_id']} messages.success(request, msg) return attach - except Exception: + except Exception as e: redirect = reverse(INDEX_URL) exceptions.handle(request, - _("Unable to attach policy."), + _("Unable to attach policy: %s") % e, redirect=redirect) diff --git a/senlin_dashboard/cluster/clusters/views.py b/senlin_dashboard/cluster/clusters/views.py index 0d3e4172..7339d0ba 100644 --- a/senlin_dashboard/cluster/clusters/views.py +++ b/senlin_dashboard/cluster/clusters/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception: + except Exception as e: self._prev = self._more = False clusters = [] - msg = _('Unable to retrieve clusters.') + msg = _('Unable to retrieve clusters: %s') % e exceptions.handle(self.request, msg) return clusters @@ -91,8 +91,8 @@ class DetailView(tabs.TabView): cluster = senlin.cluster_get(self.request, cluster_id) cluster.profile_url = reverse_lazy(self.profile_url, args=[cluster.profile_id]) - except Exception: - msg = _("Unable to retrieve cluster.") + except Exception as e: + msg = _("Unable to retrieve cluster: %s") % e url = reverse_lazy(clusters_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return cluster diff --git a/senlin_dashboard/cluster/nodes/forms.py b/senlin_dashboard/cluster/nodes/forms.py index c3f94d01..9605cf3e 100644 --- a/senlin_dashboard/cluster/nodes/forms.py +++ b/senlin_dashboard/cluster/nodes/forms.py @@ -86,10 +86,10 @@ class CreateForm(forms.SelfHandlingForm): msg = _('Creating node "%s" successfully') % data['name'] messages.info(request, msg) return node - except Exception: + except Exception as e: redirect = reverse("horizon:cluster:nodes:index") exceptions.handle(request, - _("Unable to create node."), + _("Unable to create node: %s") % e, redirect=redirect) @@ -133,9 +133,9 @@ class UpdateNodeForm(forms.SelfHandlingForm): ' has been accepted for processing.') % data['name']) return node - except Exception: + except Exception as e: redirect = reverse("horizon:cluster:nodes:index") exceptions.handle(request, - _("Unable to update node."), + _("Unable to update node: %s") % e, redirect=redirect) return False diff --git a/senlin_dashboard/cluster/nodes/views.py b/senlin_dashboard/cluster/nodes/views.py index 990d1d7f..4a65b073 100644 --- a/senlin_dashboard/cluster/nodes/views.py +++ b/senlin_dashboard/cluster/nodes/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception: + except Exception as e: self._prev = self._more = False nodes = [] - msg = _('Unable to retrieve nodes.') + msg = _('Unable to retrieve nodes: %s') % e exceptions.handle(self.request, msg) return nodes @@ -90,8 +90,8 @@ class DetailView(tabs.TabView): # Get initial node information node_id = self.kwargs["node_id"] node = senlin.node_get(self.request, node_id) - except Exception: - msg = _("Unable to retrieve node.") + except Exception as e: + msg = _("Unable to retrieve node: %s") % e url = reverse_lazy("horizon:cluster:nodes:index") exceptions.handle(self.request, msg, redirect=url) return node @@ -145,8 +145,8 @@ class UpdateView(forms.ModalFormView): "role": node.role, "metadata": metadata} - except Exception: - msg = _("Unable to retrieve node.") + except Exception as e: + msg = _("Unable to retrieve node: %s") % e url = reverse_lazy("horizon:cluster:nodes:index") exceptions.handle(self.request, msg, redirect=url) return node_dict diff --git a/senlin_dashboard/cluster/policies/forms.py b/senlin_dashboard/cluster/policies/forms.py index 760af83d..505b29f4 100644 --- a/senlin_dashboard/cluster/policies/forms.py +++ b/senlin_dashboard/cluster/policies/forms.py @@ -91,9 +91,9 @@ class CreatePolicyForm(forms.SelfHandlingForm): _('Your policy %s has been created.') % args['name']) return policy - except Exception: + except Exception as e: redirect = reverse(INDEX_URL) - msg = _('Unable to create new policy') + msg = _('Unable to create new policy: %s') % e exceptions.handle(request, msg, redirect=redirect) return False @@ -114,8 +114,8 @@ class UpdatePolicyForm(forms.SelfHandlingForm): except ValidationError as e: self.api_error(e.messages[0]) return False - except Exception: + except Exception as e: redirect = reverse(INDEX_URL) - msg = _('Unable to update policy') + msg = _('Unable to update policy: %s') % e exceptions.handle(request, msg, redirect=redirect) return False diff --git a/senlin_dashboard/cluster/policies/views.py b/senlin_dashboard/cluster/policies/views.py index 01c31652..c8c6f6a2 100644 --- a/senlin_dashboard/cluster/policies/views.py +++ b/senlin_dashboard/cluster/policies/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception: + except Exception as e: self._prev = self._more = False policies = [] - msg = _('Unable to retrieve policies.') + msg = _('Unable to retrieve policies: %s') % e exceptions.handle(self.request, msg) return policies @@ -90,8 +90,8 @@ class DetailView(tabs.TabView): policy = senlin.policy_get(self.request, policy_id) policy.policy_spec = yaml.safe_dump(policy.spec, default_flow_style=False) - except Exception: - msg = _("Unable to retrieve policy.") + except Exception as e: + msg = _("Unable to retrieve policy: %s") % e url = reverse_lazy(policies_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return policy @@ -129,8 +129,8 @@ class UpdateView(forms.ModalFormView): policy = senlin.policy_get(self.request, policy_id) policy_dict = {"policy_id": policy_id, "name": policy.name} - except Exception: - msg = _("Unable to retrieve policy.") + except Exception as e: + msg = _("Unable to retrieve policy: %s") % e url = reverse_lazy(policies_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return policy_dict diff --git a/senlin_dashboard/cluster/receivers/forms.py b/senlin_dashboard/cluster/receivers/forms.py index 2e79bcf6..9bbdd8a4 100644 --- a/senlin_dashboard/cluster/receivers/forms.py +++ b/senlin_dashboard/cluster/receivers/forms.py @@ -96,8 +96,8 @@ class CreateReceiverForm(forms.SelfHandlingForm): _('Your receiver %s has been created successfully.') % data['name']) return receiver - except Exception: + except Exception as e: redirect = reverse(INDEX_URL) - msg = _('Unable to create new receiver') + msg = _('Unable to create new receiver: %s') % e exceptions.handle(request, msg, redirect=redirect) return False diff --git a/senlin_dashboard/cluster/receivers/views.py b/senlin_dashboard/cluster/receivers/views.py index 5b606e25..54344fcc 100644 --- a/senlin_dashboard/cluster/receivers/views.py +++ b/senlin_dashboard/cluster/receivers/views.py @@ -55,10 +55,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception: + except Exception as e: self._prev = self._more = False receivers = [] - msg = _('Unable to retrieve receivers.') + msg = _('Unable to retrieve receivers: %s') % e exceptions.handle(self.request, msg) return receivers @@ -87,8 +87,8 @@ class DetailView(tabs.TabView): # Get initial receiver information receiver_id = self.kwargs["receiver_id"] receiver = senlin.receiver_get(self.request, receiver_id) - except Exception: - msg = _("Unable to retrieve receiver.") + except Exception as e: + msg = _("Unable to retrieve receiver: %s") % e url = reverse_lazy("horizon:cluster:receivers:index") exceptions.handle(self.request, msg, redirect=url) return receiver