コード例 #1
0
ファイル: config_server.py プロジェクト: rohe/oictest
def handle_load_existing_config(response_encoder, session, parameters):
    if ISSUER_QUERY_KEY in parameters and INSTANCE_ID_QUERY_KEY in parameters:
        configurations = load_configuration_from_database(parameters)

        if not configurations:
            issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
            instance_id = parameters[INSTANCE_ID_QUERY_KEY]
            port_db = PortDatabase(CONF.PORT_DATABASE_FILE)
            port = port_db.get_port(issuer, instance_id)
            configurations = identify_existing_config_file(port, CONF.OPRP_DIR_PATH)

        store_query_parameter(parameters, session, ISSUER_QUERY_KEY)
        store_query_parameter(parameters, session, INSTANCE_ID_QUERY_KEY)

        if configurations:
            session[OP_CONFIG] = configurations
        else:
            session[OP_CONFIG] = get_default_client()

        session[IS_RECONFIGURING] = True
        return response_encoder.return_json("{}")
    return response_encoder.bad_request()
コード例 #2
0
def handle_load_existing_config(response_encoder, session, parameters):
    if ISSUER_QUERY_KEY in parameters and INSTANCE_ID_QUERY_KEY in parameters:
        configurations = load_configuration_from_database(parameters)

        if not configurations:
            issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
            instance_id = parameters[INSTANCE_ID_QUERY_KEY]
            port_db = PortDatabase(CONF.PORT_DATABASE_FILE)
            port = port_db.get_port(issuer, instance_id)
            configurations = identify_existing_config_file(port, CONF.OPRP_DIR_PATH)

        store_query_parameter(parameters, session, ISSUER_QUERY_KEY)
        store_query_parameter(parameters, session, INSTANCE_ID_QUERY_KEY)

        if configurations:
            session[OP_CONFIG] = configurations
        else:
            session[OP_CONFIG] = get_default_client()

        session[IS_RECONFIGURING] = True
        return response_encoder.return_json("{}")
    return response_encoder.bad_request()
コード例 #3
0
def handle_create_new_config_file(response_encoder, session, parameters):
    store_new_test_instance(parameters, session)
    session[OP_CONFIG] = get_default_client()
    return response_encoder.return_json("{}")
コード例 #4
0
ファイル: config_server.py プロジェクト: rohe/oictest
def handle_create_new_config_file(response_encoder, session, parameters):
    store_new_test_instance(parameters, session)
    session[OP_CONFIG] = get_default_client()
    return response_encoder.return_json("{}")