From 0d3bead819590a0dc9ebbafe26fae5b8dcaba278 Mon Sep 17 00:00:00 2001 From: David Lyle Date: Tue, 1 Dec 2015 13:23:33 -0700 Subject: [PATCH] Moving exception specification Horizon defines classes of exception from the services it communicates with. In the plugin case, the plugin needs to set up including plugin content specific exceptions to the classes of exceptions in Horizon. This patch includes this content. Setting up an extensible exception list in exceptions.py and including the exceptions in the configuration files. Change-Id: Ie91cfe1e0f34a710a96b4a43cf62af35d989920c --- .../_1815_data_processing_wizard_panel.py | 5 +++++ .../_1820_data_processing_clusters_panel.py | 5 +++++ ...825_data_processing_job_executions_panel.py | 5 +++++ ..._data_processing_cluster_templates_panel.py | 5 +++++ ...ata_processing_nodegroup_templates_panel.py | 5 +++++ .../_1840_data_processing_jobs_panel.py | 5 +++++ ..._1845_data_processing_job_binaries_panel.py | 5 +++++ ..._1850_data_processing_data_sources_panel.py | 5 +++++ ...ata_processing_data_image_registry_panel.py | 5 +++++ ..._1860_data_processing_data_plugins_panel.py | 5 +++++ sahara_dashboard/exceptions.py | 18 ++++++++++++++++++ 11 files changed, 68 insertions(+) create mode 100644 sahara_dashboard/exceptions.py diff --git a/sahara_dashboard/enabled/_1815_data_processing_wizard_panel.py b/sahara_dashboard/enabled/_1815_data_processing_wizard_panel.py index 642586e..1568671 100644 --- a/sahara_dashboard/enabled/_1815_data_processing_wizard_panel.py +++ b/sahara_dashboard/enabled/_1815_data_processing_wizard_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.wizard' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.wizard.panel.WizardPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py b/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py index c0e4b56..1efdb85 100644 --- a/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py +++ b/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.clusters' @@ -29,3 +30,7 @@ ADD_INSTALLED_APPS = \ ADD_JS_FILES = [ 'dashboard/project/data_processing/data_processing.event_log.js' ] + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1825_data_processing_job_executions_panel.py b/sahara_dashboard/enabled/_1825_data_processing_job_executions_panel.py index 04cb5de..88b50b1 100644 --- a/sahara_dashboard/enabled/_1825_data_processing_job_executions_panel.py +++ b/sahara_dashboard/enabled/_1825_data_processing_job_executions_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.job_executions' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.job_executions.panel.JobExecutionsPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1830_data_processing_cluster_templates_panel.py b/sahara_dashboard/enabled/_1830_data_processing_cluster_templates_panel.py index a8877d0..29d26a6 100644 --- a/sahara_dashboard/enabled/_1830_data_processing_cluster_templates_panel.py +++ b/sahara_dashboard/enabled/_1830_data_processing_cluster_templates_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.cluster_templates' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.cluster_templates.panel.ClusterTemplatesPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1835_data_processing_nodegroup_templates_panel.py b/sahara_dashboard/enabled/_1835_data_processing_nodegroup_templates_panel.py index ae14fbf..bf64c6f 100644 --- a/sahara_dashboard/enabled/_1835_data_processing_nodegroup_templates_panel.py +++ b/sahara_dashboard/enabled/_1835_data_processing_nodegroup_templates_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.nodegroup_templates' @@ -23,3 +24,7 @@ ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.nodegroup_templates.panel.' 'NodegroupTemplatesPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py b/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py index 7ec47bf..5a82eca 100644 --- a/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py +++ b/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.jobs' @@ -25,3 +26,7 @@ ADD_JS_FILES = [ 'dashboard/project/data_processing/' 'data_processing.job_interface_arguments.js' ] + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1845_data_processing_job_binaries_panel.py b/sahara_dashboard/enabled/_1845_data_processing_job_binaries_panel.py index d330c62..7feee01 100644 --- a/sahara_dashboard/enabled/_1845_data_processing_job_binaries_panel.py +++ b/sahara_dashboard/enabled/_1845_data_processing_job_binaries_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.job_binaries' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.job_binaries.panel.JobBinariesPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1850_data_processing_data_sources_panel.py b/sahara_dashboard/enabled/_1850_data_processing_data_sources_panel.py index 66476c2..54771a6 100644 --- a/sahara_dashboard/enabled/_1850_data_processing_data_sources_panel.py +++ b/sahara_dashboard/enabled/_1850_data_processing_data_sources_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.data_sources' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.data_sources.panel.DataSourcesPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1855_data_processing_data_image_registry_panel.py b/sahara_dashboard/enabled/_1855_data_processing_data_image_registry_panel.py index d375523..e562ba8 100644 --- a/sahara_dashboard/enabled/_1855_data_processing_data_image_registry_panel.py +++ b/sahara_dashboard/enabled/_1855_data_processing_data_image_registry_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.data_image_registry' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.data_image_registry.panel.ImageRegistryPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/enabled/_1860_data_processing_data_plugins_panel.py b/sahara_dashboard/enabled/_1860_data_processing_data_plugins_panel.py index 45773c3..64e6610 100644 --- a/sahara_dashboard/enabled/_1860_data_processing_data_plugins_panel.py +++ b/sahara_dashboard/enabled/_1860_data_processing_data_plugins_panel.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from sahara_dashboard import exceptions # The slug of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'data_processing.data_plugins' @@ -22,3 +23,7 @@ PANEL_GROUP = 'data_processing' ADD_PANEL = \ ('sahara_dashboard.' 'content.data_processing.data_plugins.panel.PluginsPanel') + +ADD_EXCEPTIONS = { + 'recoverable': exceptions.RECOVERABLE +} diff --git a/sahara_dashboard/exceptions.py b/sahara_dashboard/exceptions.py new file mode 100644 index 0000000..f88343f --- /dev/null +++ b/sahara_dashboard/exceptions.py @@ -0,0 +1,18 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from saharaclient.api import base as saharaclient + +RECOVERABLE = ( + saharaclient.APIException, +)