Project

Profile

Help

Issue #1040

closed

Search with Get does not work

Added by ipanova@redhat.com over 9 years ago. Updated over 4 years ago.

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

Description

While trying to reproduce issue1038, found that request of search with GET does not work:

$ curl  -H "Accept: application/json" -X GET -k -u admin:admin 'https://localhost/pulp/api/v2/repositories/search/?limit=1'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1479  100  1479    0     0   5479      0 --:--:-- --:--:-- --:--:--  5498
{
    "_href": "/pulp/api/v2/repositories/search/?limit=1",
    "error_message": "expected string or buffer",
    "exception": [
        "TypeError: expected string or buffer\n"
    ],
    "http_request_method": "GET",
    "http_status": 500,
    "traceback": [
        "  File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n    return self.dispatch(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n    return handler(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 237, in _auth_decorator\n    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 191, in _verify_auth\n    value = method(self, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py\", line 82, in get\n    query['filters'] = json.loads(request.GET.get('filters'))\n",
        "  File \"/usr/lib64/python2.7/json/__init__.py\", line 338, in loads\n    return _default_decoder.decode(s)\n",
        "  File \"/usr/lib64/python2.7/json/decoder.py\", line 365, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n"
    ]
}

$ curl  -H "Accept: application/json" -X GET -k -u admin:admin 'https://localhost/pulp/api/v2/consumers/search/'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1468  100  1468    0     0   5736      0 --:--:-- --:--:-- --:--:--  5734
{
    "_href": "/pulp/api/v2/consumers/search/",
    "error_message": "expected string or buffer",
    "exception": [
        "TypeError: expected string or buffer\n"
    ],
    "http_request_method": "GET",
    "http_status": 500,
    "traceback": [
        "  File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n    return self.dispatch(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n    return handler(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 237, in _auth_decorator\n    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 191, in _verify_auth\n    value = method(self, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py\", line 82, in get\n    query['filters'] = json.loads(request.GET.get('filters'))\n",
        "  File \"/usr/lib64/python2.7/json/__init__.py\", line 338, in loads\n    return _default_decoder.decode(s)\n",
        "  File \"/usr/lib64/python2.7/json/decoder.py\", line 365, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n"
    ]
}

$ curl  -H "Accept: application/json" -X GET -k -u admin:admin 'https://localhost/pulp/api/v2/content/units/rpm/search/'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1476  100  1476    0     0   5808      0 --:--:-- --:--:-- --:--:--  5833
{
    "_href": "/pulp/api/v2/content/units/rpm/search/",
    "error_message": "expected string or buffer",
    "exception": [
        "TypeError: expected string or buffer\n"
    ],
    "http_request_method": "GET",
    "http_status": 500,
    "traceback": [
        "  File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n    return self.dispatch(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n    return handler(request, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 237, in _auth_decorator\n    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 191, in _verify_auth\n    value = method(self, *args, **kwargs)\n",
        "  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py\", line 82, in get\n    query['filters'] = json.loads(request.GET.get('filters'))\n",
        "  File \"/usr/lib64/python2.7/json/__init__.py\", line 338, in loads\n    return _default_decoder.decode(s)\n",
        "  File \"/usr/lib64/python2.7/json/decoder.py\", line 365, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n"
    ]
}

Related issues

Related to Pulp - Issue #312: It is impossible to use filters with GET search requests, which makes the name of the REST view a bit of a lieCLOSED - CURRENTRELEASEamacdona@redhat.comActions

Also available in: Atom PDF