Project

Profile

Help

Issue #749

closed

API call to /repositories/repo_id/importers/importer_id/ with incorrect importer id returns a 200

Added by amacdona@redhat.com about 9 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

Summary
Since each repository can only have a single importer, the manager only uses the repo_id to get the importer. However, since the importer_id is in the url, a 404 should be returned if it does not exist.

Actual behavior
$ curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/test/importers/fake/ | python -mjson.tool

{
    "_id": {
        "$oid": "55005943e138230e5890f837"
    },
    "_ns": "repo_importers",
    "config": null,
    "id": "yum_importer",
    "importer_type_id": "yum_importer",
    "last_sync": null,
    "repo_id": "test",
    "scheduled_syncs": [],
    "scratchpad": null
}

Expected Behavior

$ curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/test/importers/fake/ | python -mjson.tool

{
    "_href": "/pulp/api/v2/repositories/test/importers/fake/",
    "error": {
        "code": "PLP0009",
        "data": {
            "resources": {
                "importer_id": "fake"
            }
        },
        "description": "Missing resource(s): importer_id=fake",
        "sub_errors": []
    },
    "error_message": "Missing resource(s): importer_id=fake",
    "exception": null,
    "http_request_method": "GET",
    "http_status": 404,
    "resources": {
        "importer_id": "fake"
    },
    "traceback": null
}

Note
As indicated in the "expected behavior", this will be fixed in the Django conversion.

Also available in: Atom PDF