Bug 735393 - pulp package search via api fails with error (and solution isn't documented)
Summary: pulp package search via api fails with error (and solution isn't documented)
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: Sprint 28
Assignee: John Matthews
QA Contact: Preethi Thomas
Depends On:
TreeView+ depends on / blocked
Reported: 2011-09-02 14:53 UTC by Justin Sherrill
Modified: 2012-02-24 20:18 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)

Description Justin Sherrill 2011-09-02 14:53:15 UTC
Perform the following command:

curl --insecure -u admin:admin -d '{"name":"kernel"}'  -H "Accept: application/json" -H "content-type: application/json" -X POST https://localhost.localdomain/pulp/api/services/search/packages/

The server will throw the following error:

2011-09-02 10:43:08,560 2487:140672166250240: pulp.server.webservices.controllers.decorators:ERROR: decorators:52 Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 48, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/services.py", line 124, in POST
    regex = data["regex"]
KeyError: 'regex'

After talking with prad, there is a 'regex' option that is

a) should be optional (defaulting to false) but isn't
b) should be documented but isn't (regex isn't in any of the documentation for package search)

So ideally both of the above would be fixed.

Comment 1 John Matthews 2011-09-08 17:53:09 UTC
Changed pulp webservices services.py to allow 'regex' to be an optional.

Commit here:

Comment 2 Jeff Ortel 2011-09-14 20:27:01 UTC
build: 0.231

Comment 3 Preethi Thomas 2011-09-16 15:08:44 UTC
[root@katello-test ~]# rpm -q pulp
[root@katello-test ~]# 

[root@katello-test ~]# curl --insecure -u admin:admin -d '{"name":"kernel"}'  -H "Accept:application/json" -H "content-type: application/json" -X POST https://localhost.localdomain/pulp/api/services/search/packages/[{"name": "kernel", "checksum": {"sha256": "c6eb442973962dc2a7d635ab1b830127b26a81d2d94ee5d6f04ef263e7348461"}, "repos": ["f14", "f14-clone"], "filename": "kernel-", "epoch": "0", "version": "", "release": "45.fc14", "_id": "874ce2aa-8bb1-4ec7-aedb-caf96e3d31c3", "arch": "x86_64", "id": "874ce2aa-8bb1-4ec7-aedb-caf96e3d31c3"}][root@katello-test ~]#

Comment 4 Preethi Thomas 2012-02-24 20:17:22 UTC
Pulp v1.0 is released
Closed Current Release.

Comment 5 Preethi Thomas 2012-02-24 20:18:24 UTC
Pulp v1.0 is released.

Note You need to log in before you can comment on or make changes to this bug.