Skip to content

Raise proper Pulp errors from failing tasks - #8096

Open
dark3rMatt3r wants to merge 1 commit into
pulp:mainfrom
dark3rMatt3r:fix-unsafe-task-exceptions
Open

dark3rMatt3r wants to merge 1 commit into
pulp:mainfrom
dark3rMatt3r:fix-unsafe-task-exceptions

Conversation

@dark3rMatt3r

Copy link
Copy Markdown

Problem

Raw, non-Pulp exceptions escaping the task runner (_execute_task) log a pulpcore.deprecation "will be sanitized" warning and would lose their messages under REDACT_UNSAFE_EXCEPTIONS in 3.130. Because the deprecations CI job asserts that log is empty, these leaks turn every PR's run red. This is the general form of the (already-closed) #7910.

Offending paths and fixes — each now raises a PulpException subclass:

  • finalize_replication raised a bare Exception; now raises ReplicateError, extended with an optional details arg to keep the failed-subtask summary (backward compatible).
  • The replicate task let raw requests HTTPErrors escape when contacting the upstream (e.g. the 404 schema fetch); these are now wrapped in ExternalServiceError, matching the existing SSL handling.
  • The generic delete tasks (general_delete/general_multi_delete/ageneral_delete) let Django ProtectedError escape; they now raise the new ProtectedResourceError (PLP0029), extending the DoesNotExist handling from Update delete task to skip over already deleted objects #7930.
  • The failing_task/afailing_task test tasks raised RuntimeError; they now raise a PulpException subclass so their messages survive redaction. The task-purge fixture uses that task instead of sleep(-1).

ProtectedResourceError is exported from pulpcore.exceptions and the pulpcore.plugin.exceptions plugin API.

Testing

  • Functional suite passes with 0 server-side "will be sanitized" warnings (the exact gate signal).
  • New unit tests (pulpcore/tests/unit/tasking/test_delete_tasks.py) cover the ProtectedErrorProtectedResourceError conversion for all three delete tasks.

Notes

  • replica.py now imports requests (present transitively via pulp-glue) — happy to add it to pyproject.toml if preferred.

Root-cause writeup: dark3rMatt3r#1

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

🤖 Generated with Claude Code

Raw non-Pulp exceptions escaping the task runner triggered
pulpcore.deprecation warnings and would lose their messages under
REDACT_UNSAFE_EXCEPTIONS in 3.130. Replication, the generic delete
tasks, and the failing test tasks now raise PulpException subclasses
(ReplicateError, ExternalServiceError, the new ProtectedResourceError,
and PulpTestError).

Assisted-by: claude-opus-4.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant