Task #7908
closed
Make sure all exceptions live in pulpcore.plugin.exceptions
Status:
CLOSED - CURRENTRELEASE
- Sprint/Milestone set to 3.9.0
- Tracker changed from Issue to Task
- % Done set to 0
- Severity deleted (
2. Medium)
- Triaged deleted (
No)
- Sprint set to Sprint 86
We'll want to document this in the plugin-writer's guide and at CHANGES/plugin_api/7908.feature, so that plugin-authors will know to look for exceptions available at pulpcore.plugin.exceptions
The only two Exception-definitions I have found outside of pulpcore.exceptions:
- pulpcore/content/handler.py:class ArtifactNotFound(Exception):
- pulpcore/app/models/content.py:class UnsupportedDigestValidationError(Exception):
pulpcore.content.handler.ArtifactNotFound appears to not be used anywhere.
There exists a pulp_container.app.registry.ArtifactNotFound(Exception), whichis unrelated (other than the name)
Proposal:
- Delete pulpcore.content.handler.ArtifactNotFound as dead code
- Create a pulpcore.exceptions.validation.UnsupportedDigestValidationError
- Make that UnsupportedDigestValidationError available to pulpcore.plugin.exceptions
- Update all of pulpcore to find UnsupportedDigestValidationError from its new location
- Mark pulpcore.app.models.UnsupportedDigestValidationError as deprecated via announcement in CHANGES
In 3.10, remove pulpcore.app.models.UnsupportedDigestValidationError
Since pulpcore.app.models.UnsupportedDigestValidationError
is not part of the pulpcore.plugin package, we don't need to put it through the deprecation cycle. Except for this 1 change I think the plan you outline is what should be done. I don't think this change will require any deprecation at all actually.
One thing that is unclear to me: is pulpcore.plugin.models.UnsupportedDigestValidationError remaining as is? I don't see anything in the plan about that and it would be kind of redundant with the step to "Make that UnsupportedDigestValidationError available to pulpcore.plugin.exceptions".
daviddavis wrote:
One thing that is unclear to me: is pulpcore.plugin.models.UnsupportedDigestValidationError remaining as is? I don't see anything in the plan about that and it would be kind of redundant with the step to "Make that UnsupportedDigestValidationError available to pulpcore.plugin.exceptions".
OK, so there are two needs here. One is to keep all the exceptions in one place, and the other is to make them accessible 'outside' of pulpcore itself. To satisfy these, UnsupportedDigestValidationError needs to move to pulpcore.plugin.exceptions.
The only problem with "just moving it", is if there exists non-pulpcore code that depends on finding it at pulpcore.plugin.models, they'll break. To be correct, we should :
- make it available at pulpcore.plugins.exceptions,
- leave it available at pulpcore.plugins.models, imported from its new location
- announce the pulpcore.plugin.models one is deprecated, and then
- remove that one in 3.10.
Whew. Does that match everyone's expectations?
Whew. Does that match everyone's expectations?
Indeed it does.
- Status changed from NEW to POST
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Also available in: Atom
PDF
Moved UnsupportedDigestValidationError to new home.
It now lives in pulpcore.plugin.exceptions.
closes #7908