Project

Profile

Help

Issue #4534

closed

Searching for modulemd_defaults without "profiles" field will crash: InvalidBSON

Added by rmcgover about 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - WORKSFORME
Priority:
Normal
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
2.18.0
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 53
Quarter:

Description

Using the Pulp content search API to search for modulemd_defaults units will crash if the search query doesn't include "profiles" field.

Tested with pulp_rpm 5c463a8d37c23aeb028a4e.

Steps to reproduce

Populate a Pulp server with some modulemd_defaults units e.g. by uploading a modulemd YAML stream.

Try to search for the units requesting only the "name", e.g.

curl -u qa:qa 'https://my-pulp-server/pulp/api/v2/content/units/modulemd_defaults/search/?limit=1\&field=name'

Expected results

Query succeeds, returns a list of modulemd_defaults units with "name" field

Actual results

Internal server error: "InvalidBSON: not enough data for a BSON document"

With backtrace:

  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 241, in _auth_decorator
    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 195, in _verify_auth
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py", line 108, in get
    return self._generate_response(query, options, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/search.py", line 195, in _generate_response
    *args, **kwargs))
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/content.py", line 296, in get_results
    units = [_process_content_unit(unit, type_id) for unit in units]
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/content.py", line 43, in _process_content_unit
    unit = serial_content.content_unit_obj(content_unit)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/serializers/content.py", line 73, in content_unit_obj
    serialize_unit_with_serializer(content_unit)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/serializers/content.py", line 49, in serialize_unit_with_serializer
    serializer.serialize(content_unit)
  File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/serializers.py", line 192, in serialize
    unit['profiles'] = profiles.decode()
  File "/usr/lib64/python2.7/site-packages/bson/__init__.py", line 963, in decode
    return _bson_to_dict(self, codec_options)
Actions #1

Updated by ttereshc about 5 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 50
Actions #2

Updated by rchan about 5 years ago

  • Sprint changed from Sprint 50 to Sprint 51
Actions #3

Updated by bmbouter about 5 years ago

  • Tags Pulp 2 added
Actions #4

Updated by daviddavis almost 5 years ago

  • Sprint changed from Sprint 51 to Sprint 52
Actions #5

Updated by ttereshc almost 5 years ago

Nice-to-have for 2.19.1, however not critical for that specific release.

Actions #6

Updated by dkliban@redhat.com almost 5 years ago

  • Platform Release set to 2.19.1
Actions #7

Updated by dkliban@redhat.com almost 5 years ago

  • Sprint/Milestone set to 2.19.1
Actions #8

Updated by rchan almost 5 years ago

  • Sprint changed from Sprint 52 to Sprint 53
Actions #9

Updated by dkliban@redhat.com almost 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com
Actions #10

Updated by dkliban@redhat.com almost 5 years ago

  • Status changed from ASSIGNED to CLOSED - WORKSFORME
  • Sprint/Milestone deleted (2.19.1)

I was not able to reproduce on Fedora 28 using MongoDB 3.6.6

I also couldn't reproduce on CentOS 7 using MongoDB 2.6.12 and pymongo 3.2

In both cases I got the following:

curl -u admin:admin  -k 'https://localhost/pulp/api/v2/content/units/modulemd_defaults/search/?limit=1&field=name'
[{"_id": "710503f7-f453-49cd-8365-01d7cb1662b8", "children": {}, "name": "walrus", "_href": "/pulp/api/v2/content/units/modulemd_defaults/710503f7-f453-49cd-8365-01d7cb1662b8/"}]
Actions #11

Updated by dkliban@redhat.com almost 5 years ago

  • Platform Release deleted (2.19.1)

Also available in: Atom PDF