diff options
author | Robin Cernin <cerninr@gmail.com> | 2019-04-15 10:22:15 +1000 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2019-12-23 20:12:30 +0900 |
commit | 31f7fc6bb24995376bb74d7de6866f5bf2b322c8 (patch) | |
tree | 9e2bfb3a88b3e50b62634690f0e00d607523585b | |
parent | 3a829be260a6c1ee8c8a73a0ff59cc68bb8d245a (diff) | |
download | horizon-31f7fc6bb24995376bb74d7de6866f5bf2b322c8.tar.gz |
Deprecate exceptions.check_message
exceptions.handle() is used in most cases consistently.
check_message() is a legacy which was introduced when exceptions
were not well classified. exceptions.handle() should cover all
common error scenarios and there is no role played by check_messages().
Let's clean up its usage and deprecate it for the future removal.
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I545b6c666d13d39cf5287ccc7c972dc746faf2fb
Closes-Bug: #1339885
-rw-r--r-- | horizon/exceptions.py | 2 | ||||
-rw-r--r-- | openstack_dashboard/dashboards/admin/aggregates/workflows.py | 2 | ||||
-rw-r--r-- | openstack_dashboard/dashboards/admin/flavors/workflows.py | 2 | ||||
-rw-r--r-- | openstack_dashboard/dashboards/admin/info/tabs.py | 3 | ||||
-rw-r--r-- | requirements.txt | 1 |
5 files changed, 5 insertions, 5 deletions
diff --git a/horizon/exceptions.py b/horizon/exceptions.py index 37616c005..a96c4dfc8 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -22,6 +22,7 @@ import sys import six +from debtcollector import removals from django.core.management import color_style from django.utils import encoding from django.utils.translation import ugettext_lazy as _ @@ -193,6 +194,7 @@ def error_color(msg): return color_style().ERROR_OUTPUT(msg) +@removals.remove(message='Use exceptions.handle() instead', version='17.2.0') def check_message(keywords, message): """Checks an exception for given keywords and raises an error if found. diff --git a/openstack_dashboard/dashboards/admin/aggregates/workflows.py b/openstack_dashboard/dashboards/admin/aggregates/workflows.py index 9da82b68d..fc2e4f683 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/workflows.py +++ b/openstack_dashboard/dashboards/admin/aggregates/workflows.py @@ -43,7 +43,7 @@ class SetAggregateInfoAction(workflows.Action): aggregates = api.nova.aggregate_details_list(self.request) except Exception: msg = _('Unable to get host aggregate list') - exceptions.check_message(["Connection", "refused"], msg) + exceptions.handle(self.request, msg) raise if aggregates is not None: for aggregate in aggregates: diff --git a/openstack_dashboard/dashboards/admin/flavors/workflows.py b/openstack_dashboard/dashboards/admin/flavors/workflows.py index e98f0ca93..2d32d33f1 100644 --- a/openstack_dashboard/dashboards/admin/flavors/workflows.py +++ b/openstack_dashboard/dashboards/admin/flavors/workflows.py @@ -85,7 +85,7 @@ class CreateFlavorInfoAction(workflows.Action): except Exception: flavors = [] msg = _('Unable to get flavor list') - exceptions.check_message(["Connection", "refused"], msg) + exceptions.handle(self.request, msg) raise if flavors is not None and name is not None: for flavor in flavors: diff --git a/openstack_dashboard/dashboards/admin/info/tabs.py b/openstack_dashboard/dashboards/admin/info/tabs.py index ed0191d5e..93d43519b 100644 --- a/openstack_dashboard/dashboards/admin/info/tabs.py +++ b/openstack_dashboard/dashboards/admin/info/tabs.py @@ -66,7 +66,6 @@ class NovaServicesTab(tabs.TableTab): services = nova.service_list(self.tab_group.request) except Exception: msg = _('Unable to get nova services list.') - exceptions.check_message(["Connection", "refused"], msg) exceptions.handle(self.request, msg) services = [] return services @@ -87,7 +86,6 @@ class CinderServicesTab(tabs.TableTab): services = cinder.service_list(self.tab_group.request) except Exception: msg = _('Unable to get cinder services list.') - exceptions.check_message(["Connection", "refused"], msg) exceptions.handle(self.request, msg) services = [] return services @@ -113,7 +111,6 @@ class NetworkAgentsTab(tabs.TableTab): agents = neutron.agent_list(self.tab_group.request) except Exception: msg = _('Unable to get network agents list.') - exceptions.check_message(["Connection", "refused"], msg) exceptions.handle(self.request, msg) agents = [] return agents diff --git a/requirements.txt b/requirements.txt index 45fa08d33..cdc8bd7ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,6 +10,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 # Horizon Core Requirements Babel!=2.4.0,>=2.3.4 # BSD +debtcollector>=1.2.0 # Apache-2.0 Django<2,>=1.11;python_version<'3.0' # BSD Django>=1.11;python_version>='3.0' # BSD django-babel>=0.6.2 # BSD |