Issue #749
closedAPI call to /repositories/repo_id/importers/importer_id/ with incorrect importer id returns a 200
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.
Updated by dkliban@redhat.com almost 10 years ago
- Severity set to Medium
- Triaged changed from No to Yes
- Platform Release set to 2.7.0
Updated by bmbouter almost 10 years ago
- Severity changed from Medium to 2. Medium
Added by Austin Macdonald over 9 years ago
Added by Austin Macdonald over 9 years ago
Updated by Anonymous over 9 years ago
- Status changed from ASSIGNED to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|089b0f0e6cd0d10063b354af59df0c4dde9e2fac.
Updated by dkliban@redhat.com over 9 years ago
- Status changed from MODIFIED to 5
Updated by igulina@redhat.com over 9 years ago
- Status changed from 5 to 6
>> rpm -qa pulp-server
pulp-server-2.7.0-0.4.beta.el7.noarch
>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/zoopark/importers/no_importer/ | python -mjson.tool
{
"_href": "/pulp/api/v2/repositories/zoopark/importers/no_importer/",
"error": {
"code": "PLP0009",
"data": {
"resources": {
"importer_id": "no_importer"
}
},
"description": "Missing resource(s): importer_id=no_importer",
"sub_errors": []
},
"error_message": "Missing resource(s): importer_id=no_importer",
"exception": null,
"http_request_method": "GET",
"http_status": 404,
"resources": {
"importer_id": "no_importer"
},
"traceback": null
}
On existing importer:
>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/zoopark/importers/ | python -mjson.tool
[
{
"_href": "/pulp/api/v2/repositories/zoopark/importers/yum_importer/",
"_id": {
"$oid": "559be5fb77b2943159a2a436"
},
"_ns": "repo_importers",
"config": {
"feed": "https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/"
},
"id": "yum_importer",
"importer_type_id": "yum_importer",
"last_sync": null,
"repo_id": "zoopark",
"scheduled_syncs": [],
"scratchpad": null
}
]
>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/zoopark/importers/yum_importer/ | python -mjson.tool
{
"_href": "/pulp/api/v2/repositories/zoopark/importers/yum_importer/",
"_id": {
"$oid": "559be5fb77b2943159a2a436"
},
"_ns": "repo_importers",
"config": {
"feed": "https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/"
},
"id": "yum_importer",
"importer_type_id": "yum_importer",
"last_sync": null,
"repo_id": "zoopark",
"scheduled_syncs": [],
"scratchpad": null
}
Updated by amacdona@redhat.com about 9 years ago
- Status changed from 6 to CLOSED - CURRENTRELEASE
django conversion - repositories
closes #707 closes #749 closes #756 closes #804 closes #805 closes #812