Project

Profile

Help

Issue #1038

500 error when searching units with include_repos

Added by dijkstra over 6 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
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

In 2.7.0, if you do a search and set the option of include_repos to a boolean value (per https://github.com/pulp/pulp/blob/fa0555041aea8c6208d407bc7ee1b00d61551a15/docs/dev-guide/integration/rest-api/content/units.rst) you get a 500 error:

Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) 'bool' object has no attribute 'lower'
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) Traceback (most recent call last):
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return self.dispatch(request, *args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return handler(request, *args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 237, in _auth_decorator
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 191, in _verify_auth
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) value = method(self, *args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 110, in wrapper
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return func(*args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py", line 109, in post
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return self._generate_response(query, options, *args, **kwargs)
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py", line 140, in _generate_response
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) return cls.response_builder(cls.get_results(query, search_method, options, *args, **kwargs))
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/content.py", line 282, in get_results
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) if options.get('include_repos', 'false').lower() == "true":
Jun 8 19:12:46 prometheus pulp: pulp.server.webservices.middleware.exception:ERROR: (30266-86240) AttributeError: 'bool' object has no attribute 'lower'

Associated revisions

Revision 10c0bc83 View on GitHub
Added by mhrivnak over 6 years ago

search API works again with optional boolean arguments

fixes #1038

Revision 10c0bc83 View on GitHub
Added by mhrivnak over 6 years ago

search API works again with optional boolean arguments

fixes #1038

History

#1 Updated by ipanova@redhat.com over 6 years ago

This is the case only with GET, seems like we would need to convert the variable to string before manipulation with it

#2 Updated by mhrivnak over 6 years ago

  • Tags Easy Fix added

#3 Updated by mhrivnak over 6 years ago

#4 Updated by mhrivnak over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to mhrivnak
  • Triaged changed from No to Yes

#5 Updated by mhrivnak over 6 years ago

These calls failed with 5xx errors. Verification should ensure that they succeed.

curl -k -d '{"criteria":{}, "include_repos":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/content/units/rpm/search/
curl -k -E ~/.pulp/user-cert.pem 'https://localhost/pulp/api/v2/content/units/rpm/search/?filters=\{\}&include_repos=true'
curl -k -d '{"criteria":{}, "importers":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/repositories/search/
curl -k -d '{"criteria":{}, "details":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/consumers/search/

#6 Updated by mhrivnak over 6 years ago

  • Status changed from ASSIGNED to POST

#7 Updated by mhrivnak over 6 years ago

  • Platform Release set to 2.7.0

#8 Updated by mhrivnak over 6 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#9 Updated by dkliban@redhat.com over 6 years ago

  • Status changed from MODIFIED to 5

#11 Updated by pthomas@redhat.com over 6 years ago

verified

[root@qe-blade-10 ~]# rpm -qa pulp-server
pulp-server-2.7.0-0.3.beta.el6.noarch
[root@qe-blade-10 ~]# 

<\pre>

<pre>
[root@qe-blade-10 ~]# curl -k -d '{"criteria":{}, "include_repos":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/content/units/rpm/search/
[][root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# curl -k -E ~/.pulp/user-cert.pem 'https://localhost/pulp/api/v2/content/units/rpm/search/?filters=\{\}&include_repos=true'
[][root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# curl -k -d '{"criteria":{}, "importers":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/repositories/search/
[][root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# curl -k -d '{"criteria":{}, "details":true}' -E ~/.pulp/user-cert.pem https://localhost/pulp/api/v2/consumers/search/
[][root@qe-blade-10 ~]# 

<\pre>

#12 Updated by pthomas@redhat.com over 6 years ago

  • Status changed from 5 to 6

#13 Updated by amacdona@redhat.com almost 6 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#15 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

#16 Updated by bmbouter over 1 year ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Please register to edit this issue

Also available in: Atom PDF