Project

Profile

Help

Issue #1384

closed

HTTP 500 when retrieving importers that have with null configs

Added by amacdona@redhat.com over 8 years ago. Updated over 3 years ago.

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

Description

It is possible(Pulp < 2.8) to have null values in the db for the `config` field of an importer. This breaks the serializer which was new in 2.7.0.

This is how to reproduce:

1. Create a repository without importers or distributors (do not use CLI)

http --json -a admin:admin --verify=no POST https://localhost/pulp/api/v2/repositories/ id=test

2. Associate an importer with this repository

http --json -a admin:admin --verify=no POST 'https://localhost/pulp/api/v2/repositories/test/importers/' importer_type_id=yum_importer

3. Attempt to retrieve the importer

http --json -a admin:admin --verify=no GET 'https://localhost/pulp/api/v2/repositories/test/?importers=true'

I have confirmed that this is not a problem for Pulp < 2.7.0 and that it is not a problem for Pulp >= 2.8. The broken serializer did not exist previously, and the Mongoengine documents convert `null` to an empty dict because `config` is a DictField.

This could be an issue in other places in the API, and if those objects have not been converted to Mongoengine they will be broken in master as well.

The specific cause is that the base serializer allows modification (removal and masking) of fields within an object, and it assumed that the fields being modified exist.

Also available in: Atom PDF