Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow removing pull-through remotes when referenced from a pull-through distribution #1729

Closed
git-hyagi opened this issue Aug 5, 2024 · 0 comments
Assignees
Labels

Comments

@git-hyagi
Copy link
Contributor

git-hyagi commented Aug 5, 2024

Version

    {                                                                                                                                                                                                                                                                                     
      "component": "core",                                                                                                                                                                                                                                                                
      "version": "3.57.0.dev",                                                                                                                                                                                                                                                            
      "package": "pulpcore",                                                                                                                                                                                                                                                              
      "module": "pulpcore.app",                                                                                                                                                                                                                                                           
      "domain_compatible": true                                                                                                                                                                                                                                                           
    },                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    {                                                                                                                                                                                                                                                                                     
      "component": "container",                                                                                                                                                                                                                                                           
      "version": "2.22.0.dev",                                                                                                                                                                                                                                                            
      "package": "pulp-container",                                                                                                                                                                                                                                                        
      "module": "pulp_container.app",                                                                                                                                                                                                                                                     
      "domain_compatible": false                                                                                                                                                                                                                                                          
    }

Describe the bug
Removing a pull-through remote that is already associated with a pull-through distribution will cause errors during an image push:
#1727 (comment)

...
   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 637, in get
     raise self.model.DoesNotExist(
 pulp_container.app.models.ContainerDistribution.DoesNotExist: ContainerDistribution matching query does not exist.
...
   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 637, in get
     raise self.model.DoesNotExist(
 pulp_container.app.models.ContainerPullThroughRemote.DoesNotExist: ContainerPullThroughRemote matching query does not exist.

To Reproduce
Steps to reproduce the behavior:

REMOTE_HREF=$(curl -sH 'content-type: application/json' -uadmin:password -XPOST http://localhost:5001/pulp/api/v3/remotes/container/pull-through/ -d '{"name": "foo", "url": "https://quay.io"}' | jq .pulp_href)
curl -H 'content-type: application/json' -uadmin:password -XPOST http://localhost:5001/pulp/api/v3/distributions/container/pull-through/ -d '{"remote": '${REMOTE_HREF}', "name": "quay-cache", "base_path": "quay-cache"}'
curl -sH 'content-type: application/json' -uadmin:password  http://localhost:5001/pulp/api/v3/remotes/container/pull-through/|jq '.results[]|.pulp_href' | xargs -I{} curl -sH 'content-type: application/json' -uadmin:password  http://localhost:5001{} -XDELETE
podman pull pulp-container:5001/quay-cache/pulp/pulp-web:stable

Expected behavior
We will handle the exception through #1727, but, in addition to that, we could also deny the removal of the remote if it is already referenced by a distribution.

@lubosmj lubosmj moved this from Not Started to Todo in Pulp Container Roadmap Aug 14, 2024
@git-hyagi git-hyagi self-assigned this Sep 13, 2024
git-hyagi added a commit to git-hyagi/pulp_container that referenced this issue Sep 13, 2024
If a pull-through remote is linked with a distribution, warn users
that removing it can cause problems to pull non-cached content.

closes: pulp#1729
@git-hyagi git-hyagi closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Pulp Container Roadmap Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants