Project

Profile

Help

Issue #804

closed

API call to associate/unassociate a unit to with bad criteria returns unhelpful exception

Added by amacdona@redhat.com over 9 years ago. Updated over 3 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

A call to /v2/repositories/<destination_repo_id>/actions/associate/ with invalid criteria returns an unhelpful exception.

To replicate

curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -d '{"source_repo_id": "zoo", "criteria": {"bad": "criteria"}}' -k -u admin:admin "https://localhost/pulp/api/v2/repositories/test/actions/associate/" | python -mjson.tool

Actual Result

{
    "_href": "/pulp/api/v2/repositories/test/actions/associate/",
    "args": [],
    "error": {
        "code": "PLP0000",
        "data": {},
        "description": "Pulp exception occurred: PulpDataException",
        "sub_errors": []
    },
    "error_message": "Pulp exception occurred: PulpDataException",
    "exception": null,
    "http_request_method": "POST",
    "http_status": 400,
    "traceback": null
}

Expected Result

{
    "_href": "/pulp/api/v2/repositories/test/actions/associate/",
    "error": {
        "code": "PLP0015",
        "data": {
            "properties": "['repo_criteria']",
            "property_names": [
                "repo_criteria"
            ]
        },
        "description": "Invalid properties: ['repo_criteria']",
        "sub_errors": [
            {
                "code": "PLP0015",
                "data": {
                    "properties": "['bad']",
                    "property_names": [
                        "bad"
                    ]
                },
                "description": "Invalid properties: ['bad']",
                "sub_errors": []
            }
        ]
    },
    "error_message": "Invalid properties: ['repo_criteria']",
    "exception": null,
    "http_request_method": "POST",
    "http_status": 400,
    "property_names": [
        "repo_criteria"
    ],
    "traceback": null
}

Note: This will be fixed in the Django Conversion

Also available in: Atom PDF