Story #8205
Updated by bmbouter over 3 years ago
## The Two Related Problem 1. The 'deprecated' data is mutable. 2. The 'deprecated' data is not correctly included in import/export data ## Solution From a high level, make the [`AnsibleCollectionDeprecated`](https://github.com/pulp/pulp_ansible/blob/4b3d63f14dd85b9bfd689074defb99a23ee72f31/pulp_ansible/app/models.py#L281) content. ### Modeling Here are the rough steps involved: 1. switch [the existing AnsibleCollectionDeprecated](https://github.com/pulp/pulp_ansible/blob/4b3d63f14dd85b9bfd689074defb99a23ee72f31/pulp_ansible/app/models.py#L281) to inherit from Content 2. Remove the [`repository_version` FK](https://github.com/pulp/pulp_ansible/blob/4b3d63f14dd85b9bfd689074defb99a23ee72f31/pulp_ansible/app/models.py#L286-L288) entirely. 3. Change the [`collection`](https://github.com/pulp/pulp_ansible/blob/4b3d63f14dd85b9bfd689074defb99a23ee72f31/pulp_ansible/app/models.py#L289) field to be a string with the collection name instead 4. Add a string field called namespace. 5. The uniqueness constraint should be the tuple "namespace", "collection_name" ### Sync Implementation The sync code will continue to parse the deprecated data in FirstStage in the same way, but instead of [saving/managing them in first-stage](https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/app/tasks/collections.py#L140-L153), have the stages pipeline handle it all by making `AnsibleCollectionDeprecated` in-memory and associating with a declarative content object. ### The Galaxy API viewset [Port this portion](https://github.com/pulp/pulp_ansible/blob/8cd963d769e5b25f957d241571e21c371264a8f4/pulp_ansible/app/galaxy/v3/views.py#L172) to look for the objects in the set of content of the RepositoryVersion. ### The viewset for set/unset deprecation handling [Port this portion](https://github.com/pulp/pulp_ansible/blob/8cd963d769e5b25f957d241571e21c371264a8f4/pulp_ansible/app/galaxy/v3/views.py#L298-L306) to generate a task that creates a RepositoryVersion ### Additional work needed to get this working with Import/Export Add a model to model resources: https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/app/modelresource.py @davidd?