예제 #1
0
def crash_verify(request):
    """Verifies crash data in crash data destinations"""
    crash_id = request.GET.get('crash_id', None)

    if not crash_id or not is_crash_id_valid(crash_id):
        return http.JsonResponse({'error': 'unknown crash id'}, status=400)

    data = {'uuid': crash_id}

    # Check S3 crash bucket for raw and processed crash data
    raw_api = models.RawCrash()
    try:
        raw_api.get(crash_id=crash_id, dont_cache=True, refresh_cache=True)
        has_raw_crash = True
    except CrashIDNotFound:
        has_raw_crash = False
    data['s3_raw_crash'] = has_raw_crash

    processed_api = models.ProcessedCrash()
    try:
        processed_api.get(crash_id=crash_id,
                          dont_cache=True,
                          refresh_cache=True)
        has_processed_crash = True
    except CrashIDNotFound:
        has_processed_crash = False
    data['s3_processed_crash'] = has_processed_crash

    # Check Elasticsearch for crash data
    supersearch_api = supersearch_models.SuperSearch()
    params = {
        '_columns': ['uuid'],
        '_results_number': 1,
        'uuid': crash_id,
        'dont_cache': True,
        'refresh_cache': True
    }
    results = supersearch_api.get(**params)
    data['elasticsearch_crash'] = (results['total'] == 1
                                   and results['hits'][0]['uuid'] == crash_id)

    # Check S3 telemetry bucket for crash data
    telemetry_api = models.TelemetryCrash()
    try:
        telemetry_api.get(crash_id=crash_id,
                          dont_cache=True,
                          refresh_cache=True)
        has_telemetry_crash = True
    except CrashIDNotFound:
        has_telemetry_crash = False
    data['s3_telemetry_crash'] = has_telemetry_crash

    # NOTE(willkg): This doesn't check postgres because that's being phased
    # out.

    return http.HttpResponse(json.dumps(data), content_type='application/json')
예제 #2
0
def crash_verify(request):
    """Verifies crash data in crash data destinations"""
    crash_id = request.GET.get("crash_id", None)

    if not crash_id or not is_crash_id_valid(crash_id):
        return http.JsonResponse({"error": "unknown crash id"}, status=400)

    data = {"uuid": crash_id}

    # Check S3 crash bucket for raw and processed crash data
    raw_api = models.RawCrash()
    try:
        raw_api.get(crash_id=crash_id, dont_cache=True, refresh_cache=True)
        has_raw_crash = True
    except CrashIDNotFound:
        has_raw_crash = False
    data["s3_raw_crash"] = has_raw_crash

    processed_api = models.ProcessedCrash()
    try:
        processed_api.get(crash_id=crash_id,
                          dont_cache=True,
                          refresh_cache=True)
        has_processed_crash = True
    except CrashIDNotFound:
        has_processed_crash = False
    data["s3_processed_crash"] = has_processed_crash

    # Check Elasticsearch for crash data
    supersearch_api = supersearch_models.SuperSearch()
    params = {
        "_columns": ["uuid"],
        "_results_number": 1,
        "uuid": crash_id,
        "dont_cache": True,
        "refresh_cache": True,
    }
    results = supersearch_api.get(**params)
    data["elasticsearch_crash"] = (results["total"] == 1
                                   and results["hits"][0]["uuid"] == crash_id)

    # Check S3 telemetry bucket for crash data
    telemetry_api = models.TelemetryCrash()
    try:
        telemetry_api.get(crash_id=crash_id,
                          dont_cache=True,
                          refresh_cache=True)
        has_telemetry_crash = True
    except CrashIDNotFound:
        has_telemetry_crash = False
    data["s3_telemetry_crash"] = has_telemetry_crash

    return http.HttpResponse(json.dumps(data), content_type="application/json")