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

rpm 'gpgcheck', 'repo_gpgcheck' is expected to be an integer. #677

Closed
tjmullicani opened this issue Apr 14, 2023 · 3 comments · Fixed by #833
Closed

rpm 'gpgcheck', 'repo_gpgcheck' is expected to be an integer. #677

tjmullicani opened this issue Apr 14, 2023 · 3 comments · Fixed by #833
Assignees
Labels
bug Something isn't working (template-set)

Comments

@tjmullicani
Copy link
Contributor

Summary

When running pulp rpm repository create or pulp rpm repository update with --gpgcheck or --repo-gpgcheck, I get the error below.

Steps to reproduce

$ pulp rpm repository update --name yum-docker-el7 --remote yum-docker-el7 --gpgcheck 1 --repo-gpgcheck 1
Error: Validation failed for 'repositories_rpm_rpm_partial_update':
  application/json: 'gpgcheck' is expected to be an integer.
  application/x-www-form-urlencoded: 'gpgcheck' is expected to be an integer.
  multipart/form-data: 'gpgcheck' is expected to be an integer.

Expected behavior

Action to complete successfully.

Stacktrace/Error log

Pulp and pulp-cli version info

pulp-ansible 0.16.1
pulp-cli 0.18.0
pulp-cli-deb 0.0.4
pulp-container 2.14.3
pulp-deb 2.20.1
pulp-file 1.12.0
pulp-glue 0.18.0
pulp-python 3.8.0
pulp-rpm 3.19.1
pulpcore 3.22.3

Additonal context

Setting the click.option for gpgcheck and repo-gpgcheck to type int seems to fix, but I'm not sure that's the right answer.

click.option("--gpgcheck", type=click.Choice(("0", "1"))),

update_options = [
...
  click.option("--gpgcheck", type=int),
  click.option("--repo-gpgcheck", type=int),
...
]
@tjmullicani tjmullicani added bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg labels Apr 14, 2023
@mdellweg mdellweg removed the Triage-Needed Needs to be reviewed at next pulp-cli mtg label Apr 26, 2023
@ggainey
Copy link
Contributor

ggainey commented Apr 26, 2023

Given that a .repo file wants this to be 0 or 1, and the REST API wants 0 or 1, and the database wants 0 or 1, I think making this type=int is exactly the right answer. We could make it a flag, and then have the CLI convert it to 0/1 on the way up to the REST call - but the "consistency" argument wins for me.

@stevebleazard
Copy link

This also applies to --gpgcheck. After a bit of testing I came up with
...
click.option("--gpgcheck", type=click.IntRange(0,1)),
click.option("--repo-gpgcheck", type=click.IntRange(0,1)),
...
This will restrict the values to 0 and 1

@MichalPysik MichalPysik self-assigned this Nov 23, 2023
@MichalPysik
Copy link
Member

@stevebleazard 's solution obviously no longer prints [0|1] in help text (it prints 'INTEGER RANGE' instead), which was quite useful, but it still prints [0<=x<=1], which is the same information, just in a bit uglier format sadly.

I'm opening a bugfix, but maybe we may want to do something like a callback that transforms CHOICE to INT, just for the prettier help text.

MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 23, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 24, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 24, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 24, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 27, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 27, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository now require an
integer instead of click.choice(0, 1).

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 27, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 27, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 28, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 30, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 30, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
MichalPysik added a commit to MichalPysik/pulp-cli that referenced this issue Nov 30, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes pulp#677
mdellweg pushed a commit that referenced this issue Nov 30, 2023
Arguments --gpgcheck and --repo-gpgcheck in creating a rpm repository no
longer fail to convert to integer.

closes #677
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (template-set)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants