Skip to content

Do not create an rpm publication after package upload if autopublish is enabled on the repository #1284

@balasankarc

Description

@balasankarc

Summary

When uploading a package using pulp rpm content upload command, after uploading a package, by default rpm will attempt to create a publication with the newly created repository version. If repository has autopublish enabled, this is redundant.

Because of bugs like pulp/pulp_rpm#4238, it can even cause the command to exit with a non-zero value. Autopublish will work for repository owner, but CLI tries to explicitly create a publication and fail because of pulp/pulp_rpm#4238.

Steps to reproduce

  1. Create an rpm repository with autopublish enabled
  2. Push a content to the repository, and see that the CLI attempts to create a publication after uploading the package by hitting the pulp/api/v3/publications/rpm/rpm/ endpoint with a POST request

The following is the verbose logs when running pulp -v rpm content upload command (I snipped to the end where upload itself is nearing completion

Response: 200
.uploads_update : put http://0.0.0.0:5001/pulp/api/v3/uploads/019b08b5-ca33-7a4d-9716-df67879d80fc/
Response: 200
.Upload complete.
repositories_rpm_rpm_list : get http://0.0.0.0:5001/pulp/api/v3/repositories/rpm/rpm/?name=test-rpm-repo&offset=0&limit=1
Response: 200
content_rpm_packages_create : post http://0.0.0.0:5001/pulp/api/v3/content/rpm/packages/
Response: 202
tasks_read : get http://0.0.0.0:5001/pulp/api/v3/tasks/019b08b5-d68d-7299-b1b5-3f722930b740/
Response: 200
Started background task /pulp/api/v3/tasks/019b08b5-d68d-7299-b1b5-3f722930b740/
.tasks_read : get http://0.0.0.0:5001/pulp/api/v3/tasks/019b08b5-d68d-7299-b1b5-3f722930b740/
Response: 200
Done.
content_rpm_packages_read : get http://0.0.0.0:5001/pulp/api/v3/content/rpm/packages/019b0893-758d-7886-bd54-e927ed1926b7/
Response: 200
repositories_rpm_rpm_read : get http://0.0.0.0:5001/pulp/api/v3/repositories/rpm/rpm/019b088c-40bc-7752-9db9-b521b5b56d4a/
Response: 200
Created new version 2 in test-rpm-repo
Publishing repository test-rpm-repo.
publications_rpm_rpm_create : post http://0.0.0.0:5001/pulp/api/v3/publications/rpm/rpm/
Response: 403
Error: Operation publications_rpm_rpm_create is not authorized.

We can see that there is an explicit attempt to create a publication

publications_rpm_rpm_create : post http://0.0.0.0:5001/pulp/api/v3/publications/rpm/rpm/

To compare, this is what the pulp -v deb content upload reports

.uploads_update : put http://0.0.0.0:5001/pulp/api/v3/uploads/019b08b7-881a-7f57-b189-50d26ce67c14/
Response: 200
.Upload complete.
repositories_deb_apt_list : get http://0.0.0.0:5001/pulp/api/v3/repositories/deb/apt/?name=test-deb-repo&offset=0&limit=1
Response: 200
content_deb_packages_create : post http://0.0.0.0:5001/pulp/api/v3/content/deb/packages/
Response: 202
tasks_read : get http://0.0.0.0:5001/pulp/api/v3/tasks/019b08b7-93c2-7c82-a05c-c2b29f41a77f/
Response: 200
Started background task /pulp/api/v3/tasks/019b08b7-93c2-7c82-a05c-c2b29f41a77f/
.tasks_read : get http://0.0.0.0:5001/pulp/api/v3/tasks/019b08b7-93c2-7c82-a05c-c2b29f41a77f/
Response: 200
Done.
content_deb_packages_read : get http://0.0.0.0:5001/pulp/api/v3/content/deb/packages/019b088d-d84a-75e9-b0f6-0a398e0da717/

Expected behavior

If autopublish is enabled on the repository, CLI will not attempt to create a publication after uploading a package, but rather let pulpcore create one automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage-NeededNeeds to be reviewed at next pulp-cli mtgbugSomething isn't working (template-set)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions