Project

Profile

Help

Issue #805

closed

API call to import into a repo throws 500 when missing required params

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

If the call to this endpoint is missing any of the required body parameters, a server error occurs (KeyError)

To replicate

$ curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -d '' -k -u admin:admin "https://localhost/pulp/api/v2/repositories/test/actions/import_upload/" | python -mjson.tool

Actual Results

{
    "_href": "/pulp/api/v2/repositories/test/actions/import_upload/",
    "error_message": "'upload_id'",
    "exception": [
        "KeyError: 'upload_id'\n"
    ],
    "http_request_method": "POST",
    "http_status": 500,
    "traceback": [
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/middleware/exception.py\", line 46, in __call__\n    return self.app(environ, start_response)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/middleware/postponed.py\", line 55, in __call__\n    return self.app(environ, start_response)\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 279, in wsgi\n    result = self.handle_with_processors()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 18, in _handle_with_processors\n    return process(self.processors)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in process\n    return p(lambda: process(processors))\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 566, in processor\n    return handler()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in <lambda>\n    return p(lambda: process(processors))\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in process\n    return p(lambda: process(processors))\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 581, in processor\n    result = handler()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in <lambda>\n    return p(lambda: process(processors))\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 17, in process\n    return self.handle()\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 230, in handle\n    return self._delegate(fn, self.fvars, args)\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 422, in _delegate\n    return f()\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 430, in <lambda>\n    f = lambda: self._delegate_sub_application(pat, what)\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 455, in _delegate_sub_application\n    return app.handle_with_processors()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 18, in _handle_with_processors\n    return process(self.processors)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in process\n    return p(lambda: process(processors))\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 566, in processor\n    return handler()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in <lambda>\n    return p(lambda: process(processors))\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in process\n    return p(lambda: process(processors))\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 581, in processor\n    result = handler()\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 15, in <lambda>\n    return p(lambda: process(processors))\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/application.py\", line 17, in process\n    return self.handle()\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 230, in handle\n    return self._delegate(fn, self.fvars, args)\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 420, in _delegate\n    return handle_class(cls)\n",
        "  File \"/usr/lib/python2.7/site-packages/web/application.py\", line 396, in handle_class\n    return tocall(*args)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/controllers/decorators.py\", line 241, in _auth_decorator\n    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/controllers/decorators.py\", line 195, in _verify_auth\n    value = method(self, *args, **kwargs)\n",
        "  File \"/home/austin/devel/pulp/server/pulp/server/webservices/controllers/repositories.py\", line 860, in POST\n    upload_id = params['upload_id']\n"
    ]
}

Expected Results

400 error with details about missing params.

Note: this will be fixed in the django conversion

Also available in: Atom PDF