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

Fixes #38040 - Clear retain_version_count when mirroring policy is not additive #11285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sjha4
Copy link
Member

@sjha4 sjha4 commented Jan 22, 2025

What are the changes introduced in this pull request?

  1. On the API, clear out retain_package_versions_count when mirroring policy is anything other than additive
  2. Add a validation on root model to make sure retain_package_versions_count is only set when mirroring policy is additive.

Considerations taken when implementing this change?

What are the testing steps for this pull request?

  1. Create a yum repo with some retain_package_versions_count and mirroring policy as Additive
  2. Sync
  3. Now update mirroring policy to Content only/Complete and sync again.
  4. You'll see an error.
  5. In console if you check repo.root.retain_package_versions_count it will still have the value from step 1

With this change,
In step 4 you'll not see the sync error
In console if you check repo.root.retain_package_versions_count you'll see nil

We can also test the validation by doing so in console:

repo.root.mirroring_policy = "mirror_complete"
repo.root.retain_package_versions_count = 3
repo.root.valid? # false
repo.root.errors.messages # {:retain_package_versions_count=>["cannot be set for repos without 'Additive' mirroring policy."]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant