Skip to content

Commit

Permalink
Resource lookup option --repository is now an eager parameter.
Browse files Browse the repository at this point in the history
Use entered order of parameters matter, and can lead to unexpected behavior in some cases.
Resource lookup option is now an eager parameter, which means it is processed before all
non-eager parameters, no matter the order user entered them in.

closes pulp#650
  • Loading branch information
MichalPysik committed Dec 11, 2023
1 parent 539faee commit 202cfbc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/650.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resource lookup option --repository is now an eager (high priority) parameter.
1 change: 1 addition & 0 deletions pulpcore/cli/common/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ def _type_callback(ctx: click.Context, param: click.Parameter, value: t.Optional
repository_lookup_option = resource_lookup_option(
"--repository",
context_class=PulpRepositoryContext,
is_eager=True,
)
remote_lookup_option = resource_lookup_option(
"--remote",
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/pulp_container/test_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ expect_succ pulp container repository content -t "manifest" list --repository "c
test "$(echo "$OUTPUT" | jq -r 'length')" -eq 1
test "$(echo "$OUTPUT" | jq -r '.[0].digest')" = "$DIGEST"

expect_succ pulp container repository copy-manifest --repository "cli_test_dest_container_repository" --source "cli_test_source_container_repository" --version "1" --media-type "application/vnd.docker.distribution.manifest.v2+json"
expect_succ pulp container repository copy-manifest --version "1" --repository "cli_test_dest_container_repository" --source "cli_test_source_container_repository" --media-type "application/vnd.docker.distribution.manifest.v2+json"
expect_succ pulp container repository content -t "manifest" list --repository "cli_test_dest_container_repository" --version "2"
COPIED="$(echo "$OUTPUT" | jq -r 'length')"
test "$COPIED" -gt 1
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/pulp_file/test_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ expect_succ pulp file repository version repair --repository "cli_test_file_repo
test "$(echo "$OUTPUT" | jq -r '.state')" = "completed"

# Delete version again
expect_succ pulp file repository version destroy --repository "cli_test_file_repository" --version 1
expect_succ pulp file repository version destroy --version 1 --repository "cli_test_file_repository"

# Test autopublish
if pulp debug has-plugin --name "file" --min-version "1.7.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/pulp_rpm/test_rpm_sync_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ then
fi

expect_succ pulp rpm repository version list --repository "cli_test_rpm_repository"
expect_succ pulp rpm repository version repair --repository "cli_test_rpm_repository" --version 1
expect_succ pulp rpm repository version repair --version 1 --repository "cli_test_rpm_repository"

expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --retain-package-versions 2
expect_succ pulp rpm repository show --name "cli_test_rpm_repository"
Expand Down

0 comments on commit 202cfbc

Please sign in to comment.