Project

Profile

Help

Issue #7284

closed

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

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

Also available in: Atom PDF