示例#1
0
def rescan_issues():
    """
    Re-scan all JIRA issues that are in the "Needs Triage" state. If any were
    created by edX employees, they will be automatically transitioned to an
    "Open" state.

    Normally, issues are processed automatically. However, sometimes an issue
    is skipped accidentally, either due to a network hiccup, a bug in JIRA,
    or this bot going offline. This endpoint is used to clean up after these
    kind of problems.
    """
    jql = request.form.get("jql") or 'status = "Needs Triage" ORDER BY key'
    sentry.client.extra_context({"jql": jql})
    issues = jira_paginated_get(
        "/rest/api/2/search",
        jql=jql,
        obj_name="issues",
        session=jira,
    )
    results = {}

    for issue in issues:
        issue_key = to_unicode(issue["key"])
        results[issue_key] = issue_opened(issue)

    resp = make_response(json.dumps(results), 200)
    resp.headers["Content-Type"] = "application/json"
    return resp
示例#2
0
def jira_rescan():
    if request.method == "GET":
        # just render the form
        return render_template("jira_rescan.html")
    jql = request.form.get("jql") or 'status = "Needs Triage" ORDER BY key'
    bugsnag_context = {"jql": jql}
    bugsnag.configure_request(meta_data=bugsnag_context)
    issues = jira_paginated_get("/rest/api/2/search", "issues", jql=jql, session=jira)
    results = {}

    for issue in issues:
        issue_key = issue["key"].decode('utf-8')
        results[issue_key] = issue_opened(issue)

    resp = make_response(json.dumps(results), 200)
    resp.headers["Content-Type"] = "application/json"
    return resp
示例#3
0
def rescan_issues():
    if request.method == "GET":
        # just render the form
        return render_template("jira_rescan_issues.html")
    jql = request.form.get("jql") or 'status = "Needs Triage" ORDER BY key'
    sentry.client.extra_context({"jql": jql})
    issues = jira_paginated_get(
        "/rest/api/2/search", jql=jql, obj_name="issues", session=jira,
    )
    results = {}

    for issue in issues:
        issue_key = to_unicode(issue["key"])
        results[issue_key] = issue_opened(issue)

    resp = make_response(json.dumps(results), 200)
    resp.headers["Content-Type"] = "application/json"
    return resp
示例#4
0
def jira_rescan_issues():
    if request.method == "GET":
        # just render the form
        return render_template("jira_rescan_issues.html")
    jql = request.form.get("jql") or 'status = "Needs Triage" ORDER BY key'
    bugsnag_context = {"jql": jql}
    bugsnag.configure_request(meta_data=bugsnag_context)
    issues = jira_paginated_get(
        "/rest/api/2/search", jql=jql, obj_name="issues", session=jira,
    )
    results = {}

    for issue in issues:
        issue_key = to_unicode(issue["key"])
        results[issue_key] = issue_opened(issue)

    resp = make_response(json.dumps(results), 200)
    resp.headers["Content-Type"] = "application/json"
    return resp
def rescan_issues():
    """
    Re-scan all JIRA issues that are in the "Needs Triage" state. If any were
    created by edX employees, they will be automatically transitioned to an
    "Open" state.

    Normally, issues are processed automatically. However, sometimes an issue
    is skipped accidentally, either due to a network hiccup, a bug in JIRA,
    or this bot going offline. This endpoint is used to clean up after these
    kind of problems.
    """
    jql = request.form.get("jql") or 'status = "Needs Triage" ORDER BY key'
    sentry.client.extra_context({"jql": jql})
    issues = jira_paginated_get("/rest/api/2/search", jql=jql, obj_name="issues", session=jira)
    results = {}

    for issue in issues:
        issue_key = to_unicode(issue["key"])
        results[issue_key] = issue_opened(issue)

    resp = make_response(json.dumps(results), 200)
    resp.headers["Content-Type"] = "application/json"
    return resp