Fix for sessions that point to non-existing urls
When a session is selected and then deleted, freezer-web-ui breaks by trying to create a list of clients inside a non-existing session Resolves bug: 1533705 Change-Id: I460c0abca746e74f2eab78694765ea941406ecf7
This commit is contained in:
parent
fc5d38a483
commit
c0d59cc838
@ -305,14 +305,18 @@ class Session(object):
|
||||
def jobs(self, session_id):
|
||||
session = self.get(session_id, json=True)
|
||||
jobs = []
|
||||
|
||||
if session is None:
|
||||
return jobs
|
||||
|
||||
try:
|
||||
jobs = [utils.JobsInSessionObject(k,
|
||||
session_id,
|
||||
v['client_id'],
|
||||
v['result'])
|
||||
for k, v in session['jobs'].iteritems()]
|
||||
except AttributeError:
|
||||
pass
|
||||
except AttributeError as error:
|
||||
LOG.error(error.message)
|
||||
return jobs
|
||||
|
||||
def _build(self, session):
|
||||
|
@ -32,11 +32,11 @@ class SessionsView(browsers.ResourceBrowserView):
|
||||
browser_class = project_browsers.SessionBrowser
|
||||
template_name = "disaster_recovery/sessions/browser.html"
|
||||
|
||||
@shield('Unable to get sessions list.', redirect='actions:index')
|
||||
@shield('Unable to get sessions list.', redirect='sessions:index')
|
||||
def get_sessions_data(self):
|
||||
return freezer_api.Session(self.request).list(limit=100)
|
||||
|
||||
@shield('Unable to get job list.', redirect='actions:index')
|
||||
@shield('Unable to get job list.', redirect='sessions:index')
|
||||
def get_jobs_data(self):
|
||||
if self.kwargs['session_id']:
|
||||
return freezer_api.Session(self.request).jobs(
|
||||
|
Loading…
Reference in New Issue
Block a user