Handle the exception if _extra_data(instance) is called on a missing instance

Closes-Bug: #1926928
Change-Id: Ib782ff21770978ef09eb8b44abe115b730f7e7f9
This commit is contained in:
Andrew Bogott 2021-05-02 20:05:35 -05:00
parent 3c6e8be359
commit d18e3e8f17
1 changed files with 9 additions and 1 deletions

View File

@ -79,7 +79,15 @@ class IndexView(horizon_tables.DataTableView):
msg = _('Unable to retrieve database instances.') msg = _('Unable to retrieve database instances.')
exceptions.handle(self.request, msg) exceptions.handle(self.request, msg)
for instance in instances: 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 return instances