Project

Profile

Help

Issue #9497

Updated by ipanova@redhat.com over 2 years ago

``` Validation for the repo and repo_version or repo and publication usage should be performed by plugins. 
 pulp) [vagrant@pulp3-source-fedora34 pulpcore]$ http    :24817/pulp/api/v3/distributions/container/container/e27e55b3-8b95-4383-a6e6-a4c1a0e1f7bd/  
 HTTP/1.1 200 OK 
 Access-Control-Expose-Headers: Correlation-ID 
 Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS 
 Connection: close 
 Content-Length: 615 
 Content-Type: application/json 
 Correlation-ID: 7563bf17bb2c434d810c261e0e4718e8 
 Date: Thu, 07 Oct 2021 16:48:23 GMT 
 Referrer-Policy: same-origin 
 Server: gunicorn 
 Vary: Accept, Cookie 
 X-Content-Type-Options: nosniff 
 X-Frame-Options: DENY 

 { 
     "base_path": "test", 
     "content_guard": "/pulp/api/v3/contentguards/container/content_redirect/37c77709-ffb7-49d8-9742-5c82b49e8011/", 
     "description": null, 
     "name": "testing-hello", 
     "namespace": "/pulp/api/v3/pulp_container/namespaces/d17b694b-4782-46b6-b586-722b97d48c00/", 
     "private": false, 
     "pulp_created": "2021-10-06T21:55:46.649978Z", 
     "pulp_href": "/pulp/api/v3/distributions/container/container/e27e55b3-8b95-4383-a6e6-a4c1a0e1f7bd/", 
     "pulp_labels": {}, 
     "registry_path": "localhost:24817/test", 
     "repository": null, 
     "repository_version": "/pulp/api/v3/repositories/container/container/49915ca4-6bb2-41b6-9808-88d47d6d2f32/versions/0/" 
 } 


 (pulp) [vagrant@pulp3-source-fedora34 pulpcore]$ http PATCH :24817/pulp/api/v3/distributions/container/container/e27e55b3-8b95-4383-a6e6-a4c1a0e1f7bd/ repository=/pulp/api/v3/repositories/container/container/49915ca4-6bb2-41b6-9808-88d47d6d2f32/    repository_version='' 
 HTTP/1.1 500 Internal Server Error 
 Access-Control-Expose-Headers: Correlation-ID 
 Connection: close 
 Content-Length: 145 
 Content-Type: text/html 
 Correlation-ID: de3259103a3e40c09928acf24da5e53b 
 Date: Thu, 07 Oct 2021 16:48:30 GMT 
 Referrer-Policy: same-origin 
 Server: gunicorn 
 Vary: Cookie 
 X-Content-Type-Options: nosniff 
 X-Frame-Options: DENY 

 <!doctype html> 
 <html lang="en"> 
 <head> 
   <title>Server Error (500)</title> 
 </head> 
 <body> 
   <h1>Server Error (500)</h1><p></p> 
 </body> 
 </html> 


 (pulp) [vagrant@pulp3-source-fedora34 pulpcore]$ pjournal  
 -- Journal begins at Wed 2021-09-29 12:19:31 UTC. -- 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:     File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/base.py", line 454, DistributionSerializer defined in update 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:       serializer.is_valid(raise_exception=True) 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:     File "/usr/local/lib/pulp/lib64/python3.9/site-packages/rest_framework/serializers.py", line 220, in is_valid 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:       self._validated_data = self.run_validation(self.initial_data) 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:     File "/usr/local/lib/pulp/lib64/python3.9/site-packages/rest_framework/serializers.py", line 422, in run_validation 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:       value = self.validate(value) 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:     File "/home/vagrant/devel/pulp_container/pulp_container/app/serializers.py", line 269, in validate 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]:       repository = validated_data["repository_version"].repository.cast() 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]: AttributeError: 'NoneType' object core has no attribute 'repository' 
 Oct 07 16:48:30 pulp3-source-fedora34.fluffy.example.com gunicorn[98898]: pulp [de3259103a3e40c09928acf24da5e53b]: 127.0.0.1 - admin [07/Oct/2021:16:48:30 +0000] "PATCH /pulp/api/v3/distributions/container/container/e27e55b3-8b95-4383-a6e6-a4c1a0e1f7bd/ HTTP/1.1" 500 145 "-" "HTTPie/2.5.0" 


 ``` only repo filed defined.

Back