Project

Profile

Help

Issue #4818

closed

Updating a yum_repo_metadata_file unit silently does nothing

Added by rmcgover over 5 years ago. Updated over 5 years ago.

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

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).

Actions #2

Updated by rmcgover over 5 years 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.

Actions #3

Updated by ttereshc over 5 years ago

  • Tags Pulp 2 added
Actions #4

Updated by ttereshc over 5 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 53
Actions #5

Updated by ipanova@redhat.com over 5 years 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

Actions #6

Updated by ipanova@redhat.com over 5 years ago

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

Added by ipanova@redhat.com over 5 years ago

Revision be9c8cf6 | View on GitHub

Problem: yum_repo_metadata_file cannot be updated.

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

Actions #7

Updated by ipanova@redhat.com over 5 years ago

  • Status changed from ASSIGNED to POST
Actions #8

Updated by ipanova@redhat.com over 5 years ago

  • Status changed from POST to MODIFIED
Actions #9

Updated by ttereshc over 5 years ago

  • Platform Release set to 2.20.0
Actions #10

Updated by ttereshc over 5 years ago

  • Sprint/Milestone set to 2.20.0
Actions #11

Updated by ttereshc over 5 years ago

  • Status changed from MODIFIED to 5
Actions #12

Updated by ttereshc over 5 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

Also available in: Atom PDF