Project

Profile

Help

Issue #7284

closed

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

Added by iballou over 4 years ago. Updated over 4 years 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.

Actions #1

Updated by ttereshc over 4 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 78
Actions #2

Updated by ggainey over 4 years ago

Actions #3

Updated by iballou over 4 years ago

I tested the patch and it works!

Actions #4

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 78 to Sprint 79
Actions #5

Updated by pulpbot over 4 years ago

  • Status changed from NEW to POST

Added by ggainey over 4 years ago

Revision 98a5d449 | View on GitHub

Fixed copy to check for empty-content correctly.

Added test_copy_none to suite of copy-tests.

fixes #7284 [nocoverage]

Actions #6

Updated by ggainey over 4 years ago

  • Status changed from POST to MODIFIED

Added by ggainey over 4 years ago

Revision 530485e2 | View on GitHub

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)

Actions #7

Updated by ttereshc over 4 years ago

  • Sprint/Milestone set to 3.5.1
Actions #8

Updated by pulpbot over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF