Project

Profile

Help

Issue #7284

RPM Copy API copies all content when config content is []

Added by iballou about 2 months ago. Updated about 1 month ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 79
Quarter:

Description

In my Katello code, I empty out a Pulp 3 repo and then call the RPM copy API to copy content back into it. I had one situation where the content to be copied back into the repo was empty because everything was filtered out. The result was that all the repo's content was copied from the source repo version to the destination repo. More details below:

data2 = PulpRpmClient::Copy.new

data2.config = [{:source_repo_version=>"/pulp/api/v3/repositories/rpm/rpm/9f5d9709-bf3c-4d6a-90de-98d239769919/versions/1/", :dest_repo=>"/pulp/api/v3/repositories/rpm/rpm/859d5b2d-bf70-4208-9580-662d97488ad1/", :content=>[]}]

data2.dependency_solving = false

api.copy_api.copy_content(data2)

Original repo version, emptied out:

data2 = PulpRpmClient::Copy.new

data2.config = [{:source_repo_version=>"/pulp/api/v3/repositories/rpm/rpm/9f5d9709-bf3c-4d6a-90de-98d239769919/versions/1/", :dest_repo=>"/pulp/api/v3/repositories/rpm/rpm/859d5b2d-bf70-4208-9580-662d97488ad1/", :content=>[]}]
data2.dependency_solving = false

Repo version after the empty copy call:

Version after empty copy:
{
  "pulp_href": "/pulp/api/v3/repositories/rpm/rpm/859d5b2d-bf70-4208-9580-662d97488ad1/versions/3/",
  "pulp_created": "2020-08-05T23:19:08.130503Z",
  "number": 3,
  "base_version": null,
  "content_summary": {
    "added": {
      "rpm.package": {
        "count": 2,
        "href": "/pulp/api/v3/content/rpm/packages/?repository_version_added=/pulp/api/v3/repositories/rpm/rpm/859d5b2d-bf70-4208-9580-662d97488ad1/versions/3/"
      }
    },
    "removed": {},
    "present": {
      "rpm.package": {
        "count": 2,
        "href": "/pulp/api/v3/content/rpm/packages/?repository_version=/pulp/api/v3/repositories/rpm/rpm/859d5b2d-bf70-4208-9580-662d97488ad1/versions/3/"
      }
    }
  }
}

Is this intentional?  I'm assuming not, since if I need to do dep solving I will need those other repositories to be present in the data config section.

Tested on pulp-rpm 3.4.1 and 3.5.0.

Associated revisions

Revision 98a5d449 View on GitHub
Added by ggainey about 2 months ago

Fixed copy to check for empty-content correctly.

Added test_copy_none to suite of copy-tests.

fixes #7284 [nocoverage]

Revision 530485e2 View on GitHub
Added by ggainey about 2 months ago

Fixed copy to check for empty-content correctly.

Added test_copy_none to suite of copy-tests.

fixes #7284 [nocoverage]

(cherry picked from commit 98a5d449269e8fd924811a27830fbe78ac0d1d0a)

History

#1 Updated by ttereshc about 2 months ago

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

#3 Updated by iballou about 2 months ago

I tested the patch and it works!

#4 Updated by rchan about 2 months ago

  • Sprint changed from Sprint 78 to Sprint 79

#5 Updated by pulpbot about 2 months ago

  • Status changed from NEW to POST

#6 Updated by ggainey about 2 months ago

  • Status changed from POST to MODIFIED

#7 Updated by ttereshc about 1 month ago

  • Sprint/Milestone set to 3.5.1

#8 Updated by pulpbot about 1 month ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF