Issue with session
Session could no be created when another session is deploing or open on same environment
This commit is contained in:
@@ -26,7 +26,6 @@ class Controller(object):
|
|||||||
def index(self, request, environment_id):
|
def index(self, request, environment_id):
|
||||||
log.debug(_('Session:List <EnvId: {0}>'.format(environment_id)))
|
log.debug(_('Session:List <EnvId: {0}>'.format(environment_id)))
|
||||||
|
|
||||||
|
|
||||||
filters = {'environment_id': environment_id, 'user_id': request.context.user}
|
filters = {'environment_id': environment_id, 'user_id': request.context.user}
|
||||||
|
|
||||||
unit = get_session()
|
unit = get_session()
|
||||||
@@ -44,7 +43,8 @@ class Controller(object):
|
|||||||
session.update(params)
|
session.update(params)
|
||||||
|
|
||||||
unit = get_session()
|
unit = get_session()
|
||||||
if unit.query(Session).filter_by(**{'environment_id': environment_id, 'state': 'open'}).first():
|
if unit.query(Session).filter(Session.environment_id == environment_id and Session.state.in_(
|
||||||
|
['open', 'deploing'])).first():
|
||||||
log.info('There is already open session for this environment')
|
log.info('There is already open session for this environment')
|
||||||
raise exc.HTTPConflict
|
raise exc.HTTPConflict
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user