From d18e3e8f174303336631bc2a007aeba0ed3e9878 Mon Sep 17 00:00:00 2001 From: Andrew Bogott Date: Sun, 2 May 2021 20:05:35 -0500 Subject: [PATCH] Handle the exception if _extra_data(instance) is called on a missing instance Closes-Bug: #1926928 Change-Id: Ib782ff21770978ef09eb8b44abe115b730f7e7f9 --- trove_dashboard/content/databases/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trove_dashboard/content/databases/views.py b/trove_dashboard/content/databases/views.py index 3ed6fed..775e713 100644 --- a/trove_dashboard/content/databases/views.py +++ b/trove_dashboard/content/databases/views.py @@ -79,7 +79,15 @@ class IndexView(horizon_tables.DataTableView): msg = _('Unable to retrieve database instances.') exceptions.handle(self.request, msg) for instance in instances: - self._extra_data(instance) + # The instance might have gotten deleted since we last collected + # our instance list. Try to be a bit graceful if it's gone. + try: + self._extra_data(instance) + except Exception: + msg = _('Unable to retrieve details for instance %s' % + instance.id) + redirect = reverse('horizon:project:databases:index') + exceptions.handle(self.request, msg, redirect=redirect) return instances