Hello Pulp community,

I've been banging my head against this. I'm trying to get a list of RPMs in
a repository, which I've done by structuring the URL, but I can't seem to
get any filters or field limits to work...

Here's my call that works, and returns all fields associated with the first
unit:
search = {
  "criteria": {},
  "limit":1
}
response = requests.post(API_URL + '/repositories/test_repo/search/units/'.
cert=blah, data=json.dumps(search))

Similarly it works in get format too:

response = requests.get(API_URL +
'/repositories/test_repo/search/units/?limit=1'. cert=blah))

Now, if I try to specify the "field" argument to only retrieve a specific
field ("created") I get a trackback from the call:

response = requests.get(API_URL +
'/repositories/test_repo/search/units/?field=created&limit=1'. cert=blah))

{
    "_href":
"/pulp/api/v2/repositories/test_repo/search/units/?limit=1&field=created",
    "error_message": "pop() takes at most 1 argument (2 given)",
    "exception": [
        "TypeError: pop() takes at most 1 argument (2 given)\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 241, 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 195, in _verify_auth\n    value = method(self, *args, **kwargs)\n",
        "  File
\"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py\",
line 108, in get\n    return self._generate_response(query, options, *args,
**kwargs)\n",
        "  File
\"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/repositories.py\",
line 285, in _generate_response\n    criteria =
UnitAssociationCriteria.from_client_input(query)\n",
        "  File
\"/usr/lib/python2.7/site-packages/pulp/server/db/model/criteria.py\", line
286, in from_client_input\n    association_fields =
_validate_fields(fields.pop('association', None))\n"
    ]
}

I also can't work out how to get it to accept a filter to restrict the
results by a field value:

e.g.
search = {
  "criteria": { "filters": {"created": { "gt": {"$date":
"2015-01-01T00:00:00Z"}}}},
  "limit":1
}
response = requests.post(API_URL + '/repositories/test_repo/search/units/'.
cert=blah, data=json.dumps(search))

Result: 400 error with description: "Invalid properties: ['created']

or even simpler:

search = {
  "criteria": { "filters": {"repo_id": "test_repo"}},
  "limit":1
}
response = requests.post(API_URL + '/repositories/test_repo/search/units/'.
cert=blah, data=json.dumps(search))

Result: 400 error with description: "Invalid properties: ['repo_id']

(obviously I wouldn't actually try to limit by repo_id given it's already
limited by that in the URL)

Clearly I'm doing something wrong, any help is appreciated!

Thanks

Paul
_______________________________________________
Pulp-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pulp-list

Reply via email to