Project

Profile

Help

Issue #4176

closed

from_file() and from_metadata() create different data structures in mongodb

Added by quba42 over 5 years ago. Updated about 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
3. High
Version - Debian:
Platform Release:
2.19.0
Target Release - Debian:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

When a debian package is added to mongodb using the from_file() function, then the REL_FIELDS will contain lists of dicts.

If they are added using the from_metadata() function instead, then the same information is stored in a single string as found in a Packages file instead.

Both functions are located in:

plugins/pulp_deb/plugins/db/models.py

Currently sync.py uses from_metadata, while importer.py uses from_file.
This can lead to structurally inconsistent databases.
While this is surely undesirable I am not aware of any known issues being caused by it.

I only noticed this issue because it causes a bug in a PR of mine: https://github.com/pulp/pulp_deb/pull/57
I will amend the PR to be able to handle both types of db entries.

In my estimation, to fully fix the problem such that all future db entries will be consistent, would require some significant work.
I am unsure if it is worth fixing at all, given that we all hope to switch to pulp3 in the not to distant future.

That being said, any code that accesses any REL_FIELDS in the db should be aware of this issue.
A test to explicitly test for compatibility with the two cases is also highly desirable, since the current test suite did not catch this issue in my PR.

Once I get around to it, I may add a complete example how some example package would end up in the db for each of the two functions.

Also available in: Atom PDF