Esempio n. 1
0
def conf_setup(request):
    if request.method == 'POST':
        cfg = '[general]\n'
        cfg += 'short_name = ' + str(request.POST.get("s_short_name")) + '\n'
        cfg += 'update = ' + str(request.POST.get("s_update")) + '\n'
        cfg += 'min_update_delay = ' + str(request.POST.get("s_min_update_delay")) + '\n'
        cfg += 'debug = ' + str(request.POST.get("s_debug")) + '\n'
        cfg += 'logs_dir = ' + str(request.POST.get("s_logs_dir")) + '\n'
        cfg += 'bulk_size = ' + str(request.POST.get("s_bulk_size")) + '\n'
        cfg += 'scroll_size = ' + str(request.POST.get("s_scroll_size")) + '\n'
        cfg += 'aliases_file = ' + str(request.POST.get("s_aliases_file")) + '\n'

        cfg += '[projects]\n'
        cfg += 'projects_file = ' + str(request.POST.get("s_projects_file")) + '\n'

        cfg += '[es_collection]\n'
        cfg += 'url = ' + str(request.POST.get("s_co_url")) + '\n'

        cfg += '[es_enrichment]\n'
        cfg += 'url = ' + str(request.POST.get("s_en_url")) + '\n'
        cfg += 'autorefresh = ' + str(request.POST.get("s_autorefresh")) + '\n'

        cfg += '[sortinghat]\n'
        cfg += 'host = ' + str(request.POST.get("s_host")) + '\n'
        cfg += 'user = '******'\n'
        cfg += 'password = '******'\n'
        cfg += 'database = ' + str(request.POST.get("s_database")) + '\n'
        cfg += 'load_orgs = ' + str(request.POST.get("s_load_orgs")) + '\n'
        cfg += 'orgs_file = ' + str(request.POST.get("s_orgs_file")) + '\n'
        cfg += 'autoprofile = ' + str(request.POST.get("s_autoprofile")) + '\n'
        cfg += 'matching = ' + str(request.POST.get("s_matching")) + '\n'
        cfg += 'sleep_for = ' + str(request.POST.get("s_sleep_for")) + '\n'
        cfg += 'bots_names = ' + str(request.POST.get("s_bots_names")) + '\n'
        cfg += 'unaffiliated_group = ' + str(request.POST.get("s_unaffiliated_group")) + '\n'
        cfg += 'affiliate = ' + str(request.POST.get("s_affiliate")) + '\n'

        cfg += '[phases]\n'
        cfg += 'collection = ' + str(request.POST.get("s_collection")) + '\n'
        cfg += 'identities = ' + str(request.POST.get("s_identities")) + '\n'
        cfg += 'enrichment = ' + str(request.POST.get("s_enrichment")) + '\n'
        cfg += 'panels = ' + str(request.POST.get("s_panels")) + '\n'

        cfg += '[panels]\n'
        cfg += 'kibiter_time_from = ' + str(request.POST.get("s_kibiter_time_from")) + '\n'
        cfg += 'kibiter_default_index = ' + str(request.POST.get("s_kibiter_default_index")) + '\n'
        cfg += 'kibiter_url = ' + str(request.POST.get("s_kibiter_url")) + '\n'
        cfg += 'kibiter_version = ' + str(request.POST.get("s_kibiter_version")) + '\n'
        cfg += 'community = ' + str(request.POST.get("s_community")) + '\n'
        cfg += 'gitlab-issues = ' + str(request.POST.get("s_gitlab_issues")) + '\n'
        cfg += 'gitlab-merges = ' + str(request.POST.get("s_gitlab_merges")) + '\n'

        load_setup(cfg)
    elif request.method == 'GET':
        compose_setup_form()

    return HttpResponseRedirect(CONFIGURATION_URL)
Esempio n. 2
0
def upload_setup(request):
    if request.method == 'POST':
        try:
            setup_file = request.FILES['setup']
            setup_file = setup_file.read().decode('utf-8')
            load_setup(setup_file)
        except configparser.MissingSectionHeaderError:
            pass

        return HttpResponseRedirect(CONFIGURATION_URL)
Esempio n. 3
0
def conf_backend(request):
    if request.method == 'POST':
        backend = '['+request.POST.get("s_data_source")+']\n'
        backend += 'raw_index = '+request.POST.get("s_raw_index")+'\n'
        backend += 'enriched_index = '+request.POST.get("s_enriched_index")+'\n'
        backend += 'no-archive = '+request.POST.get("s_no_archive")+'\n'
        backend += 'api-token = '+request.POST.get("s_api_token")+'\n'
        backend += 'sleep_time = '+request.POST.get("s_sleep_time")+'\n'
        backend += 'sleep-for-rate = '+request.POST.get("s_sleep_for_rate")+'\n'
        backend += 'studies = '+request.POST.get("s_studies")+'\n'
        backend += 'latest-items = '+request.POST.get("s_latest_items")+'\n'
        load_setup(backend)

    return HttpResponseRedirect(CONFIGURATION_URL)
Esempio n. 4
0
def conf_study(request):
    if request.method == 'POST':
        study = '['+request.POST.get("s_study")
        study += ':'+request.POST.get("s_data_source_study")
        study += ']\n'
        study += 'in_index = '+request.POST.get("s_in_index")+'\n'
        study += 'out_index = '+request.POST.get("s_out_index")+'\n'
        study += 'data_source = '+request.POST.get("s_data_source_s")+'\n'
        study += 'contribs_field = '+request.POST.get("s_contribs_field")+'\n'
        study += 'timeframe_field = '+request.POST.get("s_timeframe_field")+'\n'
        study += 'sort_on_field = '+request.POST.get("s_sort_on_field")+'\n'
        study += 'no_incremental = '+request.POST.get("s_no_incremental")+'\n'
        study += 'seconds = '+request.POST.get("s_seconds")+'\n'
        load_setup(study)

    return HttpResponseRedirect(CONFIGURATION_URL)