summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangshuai <446077695@qq.com>2017-03-02 08:28:04 +0800
committerzhangshuai <446077695@qq.com>2017-03-02 08:28:04 +0800
commit4037c0954a2b9684b75b94f06c3705e4dc2c275a (patch)
tree62d8acf641989a037afe367fb8dab1c9adc05efa
parentf98b2ad496f706cf5c2a70dc838ef236f4070df4 (diff)
Fix restore index page
Query restore related checkpoint may fail, because the checkpoint may be deleted. Change-Id: I6179c4179cca2ddbd85b1b12c5ff2ff9433006e6
Notes
Notes (review): Code-Review+2: Yuval Brik <yuval@brik.org.il> Code-Review+2: chenying <ying.chen@huawei.com> Workflow+1: chenying <ying.chen@huawei.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 06 Mar 2017 14:48:39 +0000 Reviewed-on: https://review.openstack.org/440152 Project: openstack/karbor-dashboard Branch: refs/heads/master
-rw-r--r--karbor_dashboard/restores/views.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/karbor_dashboard/restores/views.py b/karbor_dashboard/restores/views.py
index 801fb71..2f441bc 100644
--- a/karbor_dashboard/restores/views.py
+++ b/karbor_dashboard/restores/views.py
@@ -55,13 +55,17 @@ class IndexView(horizon_tables.DataTableView):
55 reversed_order=reversed_order) 55 reversed_order=reversed_order)
56 56
57 for restore in restores: 57 for restore in restores:
58 checkpoint = karborclient.checkpoint_get( 58 try:
59 self.request, 59 checkpoint = karborclient.checkpoint_get(
60 restore.provider_id, 60 self.request,
61 restore.checkpoint_id) 61 restore.provider_id,
62 restore.checkpoint_id)
63 plan_name = checkpoint.protection_plan["name"]
64 except Exception:
65 plan_name = "Not Found"
62 provider = karborclient.provider_get(self.request, 66 provider = karborclient.provider_get(self.request,
63 restore.provider_id) 67 restore.provider_id)
64 setattr(restore, "name", checkpoint.protection_plan["name"]) 68 setattr(restore, "name", plan_name)
65 setattr(restore, "provider_name", provider.name) 69 setattr(restore, "provider_name", provider.name)
66 70
67 except Exception: 71 except Exception: