Skip to content

Add default content guard auto-assignment for distributions within a domain - #7992

Open
dkliban wants to merge 1 commit into
pulp:mainfrom
dkliban:issue-7988/default-content-guard
Open

Add default content guard auto-assignment for distributions within a domain#7992
dkliban wants to merge 1 commit into
pulp:mainfrom
dkliban:issue-7988/default-content-guard

Conversation

@dkliban

@dkliban dkliban commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

Adds a default_content_guard field to the Domain model. When a distribution is created within a domain that has a default_content_guard set and the distribution does not specify its own content guard, the domain's default is automatically assigned. To apply multiple guards by default, set a composite content guard as the domain's default_content_guard.

Changes

  • Domain.default_content_guard foreign key (nullable, on_delete=SET_NULL) + migration
  • Distribution BEFORE_CREATE hook auto-assigns the domain default when no guard is specified (an explicit content guard always wins)
  • DomainSerializer exposes the field (plus a _prn convenience field) and validates that the guard belongs to the same domain
  • DomainViewSet select_related to avoid N+1 on list

Tests

  • Unit: serializer validation (cross-domain rejected, rejected on create, same-domain accepted)
  • Functional (pulpcore): domain default_content_guard CRUD
  • Functional (pulp_file): end-to-end auto-assignment and explicit-guard-wins

Closes: #7988

🤖 Generated with Claude Code

Add a default_content_guard field to the Domain model that is automatically
assigned to new distributions created within the domain when they do not
specify their own content guard. Use a composite content guard as the
default to apply multiple guards.

Closes: pulp#7988

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dkliban
dkliban force-pushed the issue-7988/default-content-guard branch from 0521ec5 to f3d180c Compare August 19, 2026 00:23
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.

Add default content guard auto-assignment for distributions within a domain

1 participant