Project

Profile

Help

Issue #4818

Updating a yum_repo_metadata_file unit silently does nothing

Added by rmcgover 2 months ago. Updated 10 days ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
2.20.0
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 53

Description

Attempting to upload and import a yum_repo_metadata_file unit, to a repo which already has a unit with matching data_type, claims to succeed but silently does nothing.

Steps to reproduce

(pulp-admin doesn't seem to support upload of yum_repo_metadata_file, but it can be done e.g. with curl)

1. Create & import a unit with data_type "sometype" and content "red" to zoo repo by a sequence like:

curl -X POST https://rhsm-pulp-dev:443/pulp/api/v2/content/uploads/ --data '{}'

curl -X PUT https://rhsm-pulp-dev:443/pulp/api/v2/content/uploads/9f24c7e9-99af-4182-b354-3fe1e286dc54/0/ --data 'red'

curl -X POST https://rhsm-pulp-dev:443/pulp/api/v2/repositories/zoo/actions/import_upload/ --data '{"unit_type_id": "yum_repo_metadata_file", "upload_id": "9f24c7e9-99af-4182-b354-3fe1e286dc54", "unit_key": {"repo_id": "zoo", "data_type": "sometype"}, "unit_metadata": {"checksum": "b1f51a511f1da0cd348b8f8598db32e61cb963e5fc69e2b41485bf99590ed75a", "checksum_type": "sha256"}}'

2. Wait for resulting task to complete

3. Search for yum_repo_metadata_file units in zoo repo

4. Create & import a unit with data_type "sometype" and content "green" to zoo repo by a sequence like:

curl -X POST https://rhsm-pulp-dev:443/pulp/api/v2/content/uploads/ --data '{}'

curl -X PUT https://rhsm-pulp-dev:443/pulp/api/v2/content/uploads/bd96946f-551c-4c75-8da3-58db82d3ea04/0/ --data 'green'

curl -X POST https://rhsm-pulp-dev:443/pulp/api/v2/repositories/zoo/actions/import_upload/ --data '{"unit_type_id": "yum_repo_metadata_file", "upload_id": "bd96946f-551c-4c75-8da3-58db82d3ea04", "unit_key": {"repo_id": "zoo", "data_type": "sometype"}, "unit_metadata": {"checksum": "ba4788b226aa8dc2e6dc74248bb9f618cfa8c959e0c26c147be48f6839a0b088", "checksum_type": "sha256"}}'

5. Wait for resulting task to complete

6. Search for yum_repo_metadata_file units in zoo repo

Actual results

At step (3), yum_repo_metadata_file unit with checksum b1f51a511f1d appears in the repo.

At step (6), yum_repo_metadata_file unit with checksum ba4788b22 does NOT appear in the repo, while b1f51a511f1d still appears.

i.e. no change has been made to units in the repo, while Pulp claims all tasks succeeded and didn't report any failure to the caller, nor log any warnings or errors.

Expected results

At step (3), yum_repo_metadata_file unit with checksum b1f51a511f1d appears in the repo.

At step (6), yum_repo_metadata_file unit with checksum ba4788b22 appears in the repo, while b1f51a511f1d no longer appears.

Additional info

It seems to be a regression in Pulp 2.8 introduced by f95eb3f40a79, https://pulp.plan.io/issues/1406.

Goal of that issue was meant to be:

The goal is to make 2.8.0 behavior the same as the pre 2.8.0 behavior

But it seems like that wasn't achieved, as updating an existing yum_repo_metadata_file unit worked in Pulp <2.8 and replaced old unit with new, while now the request to update is instead silently ignored.

Tested with pulp_rpm 135059e4b4e86421c (2-master).

Associated revisions

Revision be9c8cf6 View on GitHub
Added by ipanova@redhat.com 2 months ago

Problem: yum_repo_metadata_file cannot be updated.

closes #4818
https://pulp.plan.io/issues/4818

History

#2 Updated by rmcgover 2 months ago

The workaround here if you need to update a yum_repo_metadata_file unit is:

- first remove it from the repo
- then clear orphans
- then upload new one to the repo

Clearing the orphans is needed because, even if you remove units from the target repo, they're still in the DB with same unit_key as would be used for new incoming yum_repo_metadata_file to the same repo.

#3 Updated by ttereshc 2 months ago

  • Tags Pulp 2 added

#4 Updated by ttereshc 2 months ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 53

#5 Updated by ipanova@redhat.com 2 months ago

This case is covered in the sync code. We need to add same checks in upload case as well https://github.com/pulp/pulp_rpm/blob/2-master/plugins/pulp_rpm/plugins/importers/yum/sync.py#L575

#6 Updated by ipanova@redhat.com 2 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ipanova@redhat.com

#7 Updated by ipanova@redhat.com 2 months ago

  • Status changed from ASSIGNED to POST

#8 Updated by ipanova@redhat.com about 2 months ago

  • Status changed from POST to MODIFIED

#9 Updated by ttereshc 26 days ago

  • Platform Release set to 2.20.0

#10 Updated by ttereshc 26 days ago

  • Sprint/Milestone set to 2.20.0

#11 Updated by ttereshc 18 days ago

  • Status changed from MODIFIED to ON_QA

#12 Updated by ttereshc 10 days ago

  • Status changed from ON_QA to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF