pulp / pulpcore

Pulp 3 pulpcore package https://pypi.org/project/pulpcore/
GNU General Public License v2.0
301 stars 116 forks source link

Pulpcore import check should fail if the import and export versions dont match #2266

Open parthaa opened 2 years ago

parthaa commented 2 years ago

Version Please provide the versions of the pulpcore and plugin packages in use, and how they are installed. If you are using Pulp via Katello, please provide the Katello version.

Katello: 4.1 and above pulpcore 3.14 and above

Describe the bug

Pulp importer has an api endpoint to check if the content is importable indeed (throws errors like permission checks, checksum not matching etc.) See https://docs.pulpproject.org/pulpcore/restapi.html#tag/Importers:-Pulp-Import-Check However this call does not fail if the pulp versions in the toc don't match the pulpcore running on the system. This error is displayed only when the Import operation is happening

To Reproduce Steps to reproduce the behavior:

Expected behavior The export and import versions are mismatched.

This entire logic must run in the import call. https://github.com/pulp/pulpcore/blob/main/pulpcore/app/tasks/importer.py#L93-L118

ggainey commented 2 years ago

I'm going to leave this as an issue, rather than feature - but I will point out that the current REST API does exactly what it was asked for and documented, as described here in the initial ticket : https://pulp.plan.io/issues/7549 . This request makes sense, but it's a new requirement, not a bug.

ggainey commented 2 years ago

versions.json is contained inside the .tar.gz export-file. This means that implementing this requires at best opening the tarfile and extracting versions.json. At worst, it requires us to reassemble the tarfile, if it is in chunks, validating along the way.

The implication here is that this request can't be met in a way that preserves the non-intrusive nature of the /import-check/ API. I don't see a way clear to implementing this request, in a way that preserves the desired characteristics of /import-check/