Project

Profile

Help

Issue #3541

Updated by bmbouter over 4 years ago

h3. General Problem: 

 Some plugins have validation requirements for the membership of content units in a repository. The validation required depends on the plugin and the content type. Currently add/remove is done with a POST to v3/repositories/1234/versions/. This does not involve the plugins at all, so there is no opportunity for plugins to create these validations. 

 h3. Example Problem with Docker: 

 ManifestLists cannot be added unless the Manifests they refer to are also in the repository.  
 L1 is ManifestList, and it refers to (contains) 2 Manifests, M1, M2. The repository is considered corrupt if it contains L1, but not M1 and M2. M1 and M2 could be in the repository without L1. 

 h2. Solutions: 

 h3. Add a plugin opportunity There are currently several proposed solutions [0] that fall into two categories. 

 # plugin-controlled add/remove endpoints. POST to Validate 

 Allow a v3/repositories/1234/versions/ should be disabled, each plugin will need to define provide an add/remove endpoint. There are a <code>validate_repo_version</code> 

 <pre> 
 class DockerManifestList(ContentUnit): 

     ... 

     @staticmethod 
     def validate_repo_version(qs_content, repo_version): 
         """  
         Validates a repository version's DockerManifestList units. 

         This method specifically ensures that the repo has all the right DockerManifests that correspond 
         with this DockerManifestList 

         Args: 
             qs_content (django.Queryset): A Queryset of the detail instances few ideas for this content type 
             repo_version (RepositoryVersion): The Repository version how to validate 

         Raises: 
             django.core.exceptions.ValidationError: if the repository is invalid 
         """  
         namespace these endpoints, and what kind of tooling can be provided by core. 
 # check all of the validation related DockerManifestList content 
         if has_a_validation_problem: 
             raise ValidationException('Repo foo has ManifestList Y but is missing Manifest Z') 
 </pre> hooks. The core endpoint will remain and will validate using hooks that plugin writers optionally provide. 

 https://www.redhat.com/archives/pulp-dev/2018-March/msg00066.html

Back