Exemple #1
0
def restart_application():
    if not 'application_container' in session: return
    application_container = session['application_container']

    if docker_interface.container_started(session['user_container_name']):
        docker_interface.stop_container(session['user_container_name'])

    return start_application()
Exemple #2
0
def restart_application():
    if not 'application_container' in session: return
    application_container = session['application_container']
  
    if docker_interface.container_started(session['user_container_name']):
        docker_interface.stop_container(session['user_container_name'])
    
    return start_application()
def restart_application():
    application_container = session['application_container']
    if application_container is None: return
  
    if docker_interface.container_started(session['user_container_name']):
        docker_interface.stop_container(session['user_container_name'])
    
    return start_application()
Exemple #4
0
def stop_container(token):
    """
    Stops the container of the user assigned to the given API token.
    """
    user = user_by_token(token)
    if user is None:
        return jsonify({'error': 'wrong api token'})
    docker_interface.stop_container(user.username)
    return jsonify({'result': 'success'})
Exemple #5
0
def stop_container(token):
    """
    Stops the container of the user assigned to the given API token.
    """
    user = user_by_token(token)
    if user is None:
        return jsonify({'error': 'wrong api token'})
    docker_interface.stop_container(user.username)
    return jsonify({'result': 'success'})
Exemple #6
0
def reset_container():
    """
    Terminates and restarts the container for the currently logged in user.
    """
    if 'user_container_name' not in session:
        return False

    container_name = session['user_container_name']
    if docker_interface.container_started(container_name):
        docker_interface.stop_container(container_name)
    start_by_session()
    return jsonify(result=None)
Exemple #7
0
def track_logout(sender, user, **extra):
    if 'user_container_name' in session:
        docker_interface.stop_container(session['user_container_name'])
        session.pop('user_container_name')
Exemple #8
0
def track_logout(sender, user, **extra):
    if 'user_container_name' in session:
        docker_interface.stop_container(session['user_container_name'])
        session.pop('user_container_name')