Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

published updateinfo only contains units in repo #825

Merged
merged 1 commit into from
Mar 18, 2016

Conversation

tehsmyers
Copy link
Contributor

Errata units in Pulp contain all units in all repos that are linked to
errata with the same id, which was resulting in published errata
referencing packages that weren't actually available in the published
repo. This limits packages in published errata updateinfo XML to only
the packages that are contained in the published repo.

fixes #1366
https://pulp.plan.io/issues/1366

fixes #1548
https://pulp.plan.io/issues/1548

@tehsmyers
Copy link
Contributor Author

The unit tests written for this case do a reasonable job of making sure that the integration points are being called correctly, and that the new code does the right thing with expected return values from those integration points, but a "real" integration test is needed to properly cover this. I've opened a pulp-smash issue to track that effort: pulp/pulp-smash#163

repo_unit_nevra = []
for nevra_unit_id, nevra_field_values in nevra_unit_map.items():
# based on the args to scalar when nevra_units was created:
if nevra_unit_id in repo_unit_ids:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case repo_unit_ids has many entries, it would perform this operation better as a set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magnitude of repo_unit_ids length is on the order of dozens to hundreds which is trivial for a list to do well, but on this scale a set will likely always do better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for me, the diff related to this comment thread is out of date. repo_unit_ids is now a set, which can be seen in the diff view.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, I see that too now. Not sure if my view was out of date or if I just missed it.

@@ -102,6 +164,16 @@ def add_unit_metadata(self, item):
'epoch': package['epoch'] or '0',
'arch': package['arch'],
'src': package.get('src', '') or ''}

if repo_unit_nevra is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a reasonable approach given the way this function is setup. But just to say it, in an ideal world it would be better if there were a way to move this logic outside the function. Then add_unit_metadata could focus on adding metadata, and not on deciding which data to add. The obvious design would be to filter or similar up on line 159, but because of the transformation that happens in between there and here, that isn't convenient. without changing lots of stuff.

Oh well. Just an observation.

@mhrivnak
Copy link
Contributor

Looks good. Thanks for the thorough in-line documentation.

Errata units in Pulp contain all units in all repos that are linked to
errata with the same id, which was resulting in published errata
referencing packages that weren't actually available in the published
repo. This limits packages in published errata updateinfo XML to only
the packages that are contained in the published repo.

fixes pulp#1366
https://pulp.plan.io/issues/1366

fixes pulp#1548
https://pulp.plan.io/issues/1548
@tehsmyers
Copy link
Contributor Author

ok test

tehsmyers pushed a commit that referenced this pull request Mar 18, 2016
published updateinfo only contains units in repo
@tehsmyers tehsmyers merged commit de16ec1 into pulp:master Mar 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants