pulp / pulp-cli

https://docs.pulpproject.org/pulp_cli/
GNU General Public License v2.0
33 stars 41 forks source link

Support pulp_rpm advanced-copy API #990

Closed ggainey closed 2 weeks ago

ggainey commented 3 weeks ago

We don't currently support copy_content for pulp_rpm, and we should.

ggainey commented 2 weeks ago

Fun with openapi - the "config" param and JSONField and drf-spectacular are arguing. Will need to do some api_quirkness.

For posterity, here's the Copy schema :

{
  "type": "object",
  "description": "A serializer for Content Copy API.",
  "properties": {
    "config": {
      "type": "object",
      "description": "A JSON document describing sources, destinations, and content to be copied"
    },
    "dependency_solving": {
      "type": "boolean",
      "default": true,
      "description": "Also copy dependencies of the content being copied."
    }
  },
  "required": [
    "config"
  ]
}
mdellweg commented 2 weeks ago

The dependency_solving parameter seems to be unavailable on pulp_rpm 3.26 at least. Can you find actual version boundaries for it?

ggainey commented 2 weeks ago

dependency_solving in copy has been there for as long as the command has existed. Here it is in rpm/3.26 : https://github.com/pulp/pulp_rpm/blob/3.26/pulp_rpm/app/serializers/repository.py#L521

mdellweg commented 2 weeks ago

Something weird is going on with the api spec here:

$ pulp -p container debug openapi spec | jq '.info'
{
  "title": "Pulp 3 API",
  "version": "v3",
  "description": "Fetch, Upload, Organize, and Distribute Software Packages",
  "contact": {
    "name": "Pulp Team",
    "email": "pulp-list@redhat.com",
    "url": "https://pulpproject.org"
  },
  "license": {
    "name": "GPLv2+",
    "url": "https://raw.githubusercontent.com/pulp/pulpcore/master/LICENSE"
  },
  "x-logo": {
    "url": "https://pulp.plan.io/attachments/download/517478/pulp_logo_word_rectangle.svg"
  },
  "x-pulp-app-versions": {
    "core": "3.54.0",
    "ansible": "0.21.6",
    "container": "2.20.0",
    "deb": "3.2.0",
    "gem": "0.5.1",
    "maven": "0.8.0",
    "ostree": "2.3.0",
    "python": "3.11.1",
    "rpm": "3.26.0",
    "certguard": "3.54.0",
    "file": "3.54.0"
  },
  "x-pulp-domain-enabled": false
}

$ pulp -p container debug openapi schema --name Copy 
{
  "type": "object",
  "description": "A serializer for Content Copy API.",
  "properties": {
    "config": {
      "type": "object",
      "description": "A JSON document describing sources, destinations, and content to be copied"
    }
  },
  "required": [
    "config"
  ]
}
mdellweg commented 2 weeks ago

Do we implement a similar Copy concept elsewhere?

ggainey commented 2 weeks ago

Do we implement a similar Copy concept elsewhere?

I guess we do. Just for historical record, here's what the Copy schema looks like in a system with just core and pulp_rpm installed:

$pulp status
...
  "versions": [
    {
      "component": "core",
      "version": "3.55.0.dev",
      "package": "pulpcore",
      "module": "pulpcore.app",
      "domain_compatible": true
    },
    {
      "component": "rpm",
      "version": "3.28.0.dev",
      "package": "pulp-rpm",
      "module": "pulp_rpm.app",
      "domain_compatible": true
    },
    {
      "component": "certguard",
      "version": "3.56.0.dev",
      "package": "pulpcore",
      "module": "pulp_certguard.app",
      "domain_compatible": true
    },
    {
      "component": "file",
      "version": "3.56.0.dev",
      "package": "pulpcore",
      "module": "pulp_file.app",
      "domain_compatible": true
    }
  ],
...
$ pulp debug openapi schema --name Copy
{
  "type": "object",
  "description": "A serializer for Content Copy API.",
  "properties": {
    "config": {
      "description": "A JSON document describing sources, destinations, and content to be copied"
    },
    "dependency_solving": {
      "type": "boolean",
      "default": true,
      "description": "Also copy dependencies of the content being copied."
    }
  },
  "required": [
    "config"
  ]
}