Story #5708
closedAllow operation specific plugin-input for validation and/or content modification
0%
Description
Motivation¶
Plugins have a need to provide RepositoryVersion validation and/or modification for specific operations but not others. For example, for the pulp_rpm sync case, it's not important to check modulemd consistency, while for "modify" it's critical.
The RepositoryVersion.finalize_new_version runs with all operations so it's not viable to put operation-specific code there.
Design¶
Add a class attribute named PLUGIN_VALIDATE_MODIFY
to the following core-provided objects and have it default to None. Then a plugin writer would subclass the object and specify the callable on their subclass.
- DeclarativeVersion
- SingleContentArtifactUploadSerializer
- ModifyRepositoryActionMixin
The PLUGIN_VALIDATE_MODIFY callable must accept a single argument, new_version
so it has the reference to the RepositoryVersion it should validate/modify.
Note these new operation-specific validation should be called before the Repository.finalize_new_version