Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teach pulp-rpm-repository about retain-package-versions. #173

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/172.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Taught rpm/repository about the retain-package-versions attribute.
2 changes: 2 additions & 0 deletions pulpcore/cli/rpm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ def repository(ctx: click.Context, pulp_ctx: PulpContext, repo_type: str) -> Non
create_options = [
click.option("--name", required=True),
click.option("--description"),
click.option("--retain-package-versions", type=int),
click.option("--remote", callback=_remote_callback),
]
update_options = [
click.option("--description"),
click.option("--retain-package-versions", type=int),
click.option("--remote", callback=_remote_callback),
]

Expand Down
8 changes: 6 additions & 2 deletions tests/scripts/pulp_rpm/test_rpm_sync_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
pulp debug has-plugin --name "rpm" || exit 3

cleanup() {
pulp rpm remote destroy --name "cli_test_rpm_remote" || true
pulp rpm repository destroy --name "cli_test_rpm_repository" || true
pulp rpm distribution destroy --name "cli_test_rpm_distro" || true
pulp rpm repository destroy --name "cli_test_rpm_repository" || true
pulp rpm remote destroy --name "cli_test_rpm_remote" || true
Comment on lines -9 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup in reverse order?
Fine for me! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making the cleanup() match the order at test-end :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a rather recently added feature in pulp_rpm?
If yes, do you think we can guard it's use by has_plugin?

edit: Probybly needs_plugin being lazy is the better choice.

The feature has been in pulp_rpm since June , released in pulp_rpm 3.5 - does it really need a guard?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

June is older than any CLI-Release. I believe we agreed to support about 5 releases back. So assuming your test would fail on earlier versions of pulp_rpm (which it doesn't in the cli) i think we are safe.

}
trap cleanup EXIT

Expand Down Expand Up @@ -40,6 +40,10 @@ expect_succ curl "$curl_opt" --head --fail "$PULP_BASE_URL/pulp/content/cli_test
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 update --name "cli_test_rpm_repository" --retain-package-versions 2
expect_succ pulp rpm repository show --name "cli_test_rpm_repository"
test "$(echo "$OUTPUT" | jq -r '.retain_package_versions')" = "2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To disable that function, do you nullify it, or will it be set to 0, -1, ...?
Can you add a test for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set to 0 turns it off - will add a test, good call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case (also being an integer) we probably don't need a test. For nullifying there can be interesting side effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repushed a change constraining retain-package-versions to integer


expect_succ pulp rpm distribution destroy --name "cli_test_rpm_distro"
expect_succ pulp rpm publication destroy --href "$PUBLICATION_HREF"
expect_succ pulp rpm publication destroy --href "$PUBLICATION_VER_HREF"
Expand Down