Exemplo n.º 1
0
def get_configsession():

    success, errors, session = get_current_configsession()

    if not success :
        return jsonify ({'status' : 'failure', 'errors' : errors}), 404
    
    if not session:
        error = "No configuration session in progress currently."
        return jsonify ({'status' : 'failure', 'errors' : [error]}), 404

    return jsonify({'configsession': session}), 200
Exemplo n.º 2
0
def start_session():

    
    success, errors, session = get_current_configsession()

    if not success:
         return jsonify ({'status' : 'failure', 'errors' : errors}), 400


    if session != None:
        error = "A session is already in progress."
        error += "Please abort or complete current session %s" % str(session[config.ID_FIELD])
        errors = [error]
        return jsonify ({'status' : 'failure', 'errors' : errors}), 400

    success, errors, session_id = create_new_configsession()

    return jsonify({'id': str(session_id)}), 201
Exemplo n.º 3
0
    def check_configsession_in_progress(self):
        success, errors, configsession = get_current_configsession()

        if not success:
            error = "No configuration session currently in progress."
            raise ResourceException([error], 400)