diff --git a/muranoapi/api/v1/sessions.py b/muranoapi/api/v1/sessions.py index 6ba243a3..a1e0b47d 100644 --- a/muranoapi/api/v1/sessions.py +++ b/muranoapi/api/v1/sessions.py @@ -48,6 +48,11 @@ class Controller(object): unit = get_session() session = unit.query(Session).get(session_id) + if session is None: + log.error('Session is not found' + ''.format(session_id)) + raise exc.HTTPNotFound() + if session.environment_id != environment_id: log.error('Session is not tied with Environment ' ''.format(session_id, environment_id)) @@ -98,6 +103,11 @@ class Controller(object): unit = get_session() session = unit.query(Session).get(session_id) + if session is None: + log.error('Session is not found' + ''.format(session_id)) + raise exc.HTTPNotFound() + if session.environment_id != environment_id: log.error('Session is not tied with Environment ' ''.format(session_id, environment_id))