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

Fix server error when using gpgcheck/repo_gpgcheck #3369

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

pedro-psb
Copy link
Member

#3298 moved gpg options to a single field called "repo_config", but the deprecated "gpgcheck" and "repo_gpgcheck" were still being passed to the models, which caused a TypeError when trying to use them.

closes #3357

@dralley
Copy link
Contributor

dralley commented Jan 2, 2024

If you do provide those options via the API, what happens? Do you get an error or are they simply ignored?

@pedro-psb
Copy link
Member Author

pedro-psb commented Jan 3, 2024

@dralley You mean the REST Api? It's the same error as reported in the issue in both Rest and CLI (after getting that integer bugfix). I've also checked the test reproduces the bug.

Edit: I've just tested that manually again and, although no error is raised, the option is not set in repo-config as expected (neither with values 0 or 1).

@dralley
Copy link
Contributor

dralley commented Jan 3, 2024

I meant "post-patch / post-PR, if you provide that option, does it yield an error or is it ignored?"

Sounds like from your update it is ignored.

I think technically, if they are ignored that would still be incorrect behavior. Deprecating a feature doesn't mean that it will immediately stop working, just that it could be removed at some later point.

Fixing this completely would probably mean that instead of setting these fields read_only, we need to change the source to read the values from repo_config, and likewise adjust the write logic to ensure they are written to repo_config.

The alternative would be removing the feature completely and immediately, but I'm not sure I'm comfortable with that.

@ipanova Do you have an opinion?

@@ -0,0 +1,5 @@
def test_create_repo_with_deprecated_gpg_options_3357(rpm_repository_factory):
"""Can create repository with deprecated gpgcheck and repo_gpgcheck options."""
Copy link
Contributor

Choose a reason for hiding this comment

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

We ought to test both reading and writing this value. I assume writing it will be broken - it won't error, but it also won't do what the user wanted.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the tests and the approach to cover what you've pointed out. Do you think they are reflecting the intended workflow correctly?

If yes, I'll investigate the side-effects that are causing the CI to fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks correct to me, yup. The failing test is interesting, it's not obvious why that would happen.

@pedro-psb pedro-psb force-pushed the fix/deprecated-gpg-opt-error branch from 04b238d to 9779aa9 Compare January 3, 2024 16:29
pulp#3298 moved gpg options to a single
field called "repo_config", but the deprecated "gpgcheck" and "repo_gpgcheck"
were still being passed to the models, which caused a TypeError when trying
to use them.

closes pulp#3357
@pedro-psb pedro-psb force-pushed the fix/deprecated-gpg-opt-error branch from 9779aa9 to afc0fbc Compare January 4, 2024 17:25
@pedro-psb pedro-psb requested a review from dralley January 4, 2024 17:52
@dralley dralley merged commit 149bb14 into pulp:main Jan 4, 2024
16 checks passed
Copy link

patchback bot commented Jan 4, 2024

Backport to 3.24: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.24/149bb149f9de0da26669178d242a2a781c81a9cf/pr-3369

Backported as #3370

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

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

Successfully merging this pull request may close these issues.

repo_gpg options are deprecated but aren't supported at the model level
2 participants