Project

Profile

Help

Issue #4818

Updating a yum_repo_metadata_file unit silently does nothing

Added by rmcgover 5 days ago. Updated 3 days ago.

Status:
ASSIGNED
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Severity:
2. Medium
Version:
Platform Release:
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).

History

#2 Updated by rmcgover 4 days 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 4 days ago

  • Tags Pulp 2 added

#4 Updated by ttereshc 4 days ago

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

#5 Updated by ipanova@redhat.com 4 days 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 3 days ago

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

Please register to edit this issue

Also available in: Atom PDF