Skip to content

Commit

Permalink
Add the ReleaseComponent content create command
Browse files Browse the repository at this point in the history
closes #118
  • Loading branch information
quba42 committed May 6, 2024
1 parent 85d8685 commit 9c9a409
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/118.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the create command for content of type release_component.
16 changes: 14 additions & 2 deletions pulpcore/cli/deb/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _sha256_artifact_callback(
"Repository to add the content to in the form '[[<plugin>:]<resource_type>:]<name>' or by "
"href."
),
allowed_with_contexts=(PulpDebPackageContext,),
allowed_with_contexts=(PulpDebPackageContext, PulpDebReleaseComponentContext),
)


Expand Down Expand Up @@ -272,12 +272,24 @@ def content() -> None:
callback=_sha256_artifact_callback,
allowed_with_contexts=(PulpDebPackageContext,),
),
pulp_option(
"--distribution",
required=True,
help=_("The APT repo distribution to use"),
allowed_with_contexts=(PulpDebReleaseComponentContext,),
),
pulp_option(
"--component",
required=True,
help=_("The APT repo component to use"),
allowed_with_contexts=(PulpDebReleaseComponentContext,),
),
repository_option,
]
content.add_command(
create_command(
decorators=create_options,
allowed_with_contexts=(PulpDebPackageContext,),
allowed_with_contexts=(PulpDebPackageContext, PulpDebReleaseComponentContext),
)
)

Expand Down
5 changes: 5 additions & 0 deletions tests/scripts/pulp_deb/test_deb_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@ expect_succ test "$(echo "${OUTPUT}" | jq -r 'length')" -eq 4

# make sure the package we've been playing with is cleaned up immediately
expect_succ pulp orphan cleanup --content-hrefs "[\"${PACKAGE_HREF}\"]" --protection-time 0 || true

# Test creating a release_component:
expect_succ pulp deb content --type release_component create --distribution foo --component bar
RELEASE_COMPONENT_HREF=$(echo "${OUTPUT}" | jq -r .pulp_href)
expect_succ pulp orphan cleanup --content-hrefs "[\"${RELEASE_COMPONENT_HREF}\"]" --protection-time 0 || true

0 comments on commit 9c9a409

Please sign in to comment.