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

repo-config option fails to parse #1065

Open
simenon opened this issue Aug 20, 2024 · 4 comments
Open

repo-config option fails to parse #1065

simenon opened this issue Aug 20, 2024 · 4 comments
Labels
Triage-Needed Needs to be reviewed at next pulp-cli mtg

Comments

@simenon
Copy link

simenon commented Aug 20, 2024

Version
"versions": {
"deb": "3.3.1",
"gem": "0.6.1",
"rpm": "3.27.1",
"core": "3.57.1",
"file": "3.57.1",
"maven": "0.8.1",
"ostree": "2.4.3",
"python": "3.12.1",
"ansible": "0.22.1",
"certguard": "3.57.1",
"container": "2.21.0"
}

Describe the bug
pulp rpm repository create --name random --autopublish --repo-config '{"gpgcheck": 0, "repo-gpgcheck": 0}'

Error: Validation failed for 'repositories_rpm_rpm_create':
application/json: 'repo_config' is expected to be a string.
application/x-www-form-urlencoded: 'repo_config' is expected to be a string.
multipart/form-data: 'repo_config' is expected to be a string.

same error goes for rpm publication

To Reproduce
See Above

Expected behavior
--repo-config should be parsed

Additional context
based on example here https://pulpproject.org/pulp_rpm/docs/user/tutorials/create_sync_publish/?h=gpgcheck#create-a-publication-with-a-configrepo

@simenon simenon added the Triage-Needed Needs to be reviewed at next pulp-cli mtg label Aug 20, 2024
@ipanova ipanova transferred this issue from pulp/pulpcore Aug 20, 2024
@pedro-psb
Copy link
Member

Can you run in verbose mode? I copy-pasted this and got no errors w/ similar version-set.

 pulp -vvv rpm repository create --name random --autopublish --repo-config '{"gpgcheck": 0, "repo-gpgcheck": 0}'

@simenon
Copy link
Author

simenon commented Aug 21, 2024

I am not sure why it is failing, but on a system with RH8.10 it worked before. Then i updated to the latest pulp pod image and somewhere after that it started failing. On a similar test system with RH9.4 it works with no problems. I tried it on another machine with 8.10 and it works.

this seems a problem specific to one machine.

pulp -vvv rpm repository create --name random --autopublish --repo-config '{"gpgcheck": 0, "repo-gpgcheck": 0}'
Error: Validation failed for 'repositories_rpm_rpm_create':
  application/json: 'repo_config' is expected to be a string.
  application/x-www-form-urlencoded: 'repo_config' is expected to be a string.
  multipart/form-data: 'repo_config' is expected to be a string.
python --version
Python 3.6.8
pulp --version
pulp3 command line interface, version 0.23.2
pip list
Package             Version
------------------- --------
certifi             2024.6.2
charset-normalizer  2.0.12
click               8.0.4
click-shell         2.1
defusedxml          0.7.1
dynaconf            3.1.5
httpie              2.6.0
idna                3.7
importlib-metadata  4.8.3
importlib-resources 5.4.0
jq                  1.7.0
packaging           21.3
pip                 21.3.1
PuLP                2.7.0
pulp-cli            0.23.2
pulp-glue           0.23.2
Pygments            2.14.0
pyparsing           3.1.2
PySocks             1.7.1
PyYAML              6.0.1
requests            2.27.1
requests-toolbelt   1.0.0
schema              0.7.7
setuptools          39.2.0
toml                0.10.2
typing_extensions   4.1.1
urllib3             1.26.19
zipp                3.6.0

@simenon
Copy link
Author

simenon commented Aug 21, 2024

I suspect this is a python3.6 issue

Given that i create a venv for python3.6 as follows

# This does not work
python3 -m venv .venv/pulp36
source .venv/pulp36/bin/activate
pip install pulp-cli[pygments]
pulp -vvv rpm repository create --name random2 --autopublish --repo-config '{"gpgcheck": 0, "repo-gpgcheck": 0}'
Error: Validation failed for 'repositories_rpm_rpm_create':
  application/json: 'repo_config' is expected to be a string.
  application/x-www-form-urlencoded: 'repo_config' is expected to be a string.
  multipart/form-data: 'repo_config' is expected to be a string.
# This works
python3.9 -m venv .venv/pulp39
source .venv/pulp39/bin/activate
pip install pulp-cli[pygments]
pulp -vvv rpm repository create --name random2 --autopublish --repo-config '{"gpgcheck": 0, "repo-gpgcheck": 0}'
repositories_rpm_rpm_create : post http://localhost:8080/pulp/api/v3/repositories/rpm/rpm/
  User-Agent: Pulp-CLI/0.27.2
  Accept-Encoding: gzip, deflate
  Accept: application/json
  Connection: keep-alive
  Content-Length: 71
  Content-Type: application/json
  Authorization: Basic YWRtaW46NnJASDg0OjFeRy1ERDNmdjt8SDk=
b'{"name": "random2", "repo_config": {"gpgcheck": 0, "repo-gpgcheck": 0}}'
Response: 400
  Server: nginx/1.22.1
  Date: Wed, 21 Aug 2024 13:10:48 GMT
  Content-Type: application/json
  Content-Length: 39
  Connection: keep-alive
  Vary: Accept
  Allow: GET, POST, HEAD, OPTIONS
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff
  Referrer-Policy: same-origin
  Cross-Origin-Opener-Policy: same-origin
  Correlation-ID: 39cdc3c082064f59aa5c67793393bc4d
  Access-Control-Expose-Headers: Correlation-ID
{"name":["This field must be unique."]}
Error: {"name":["This field must be unique."]}

@pedro-psb
Copy link
Member

pedro-psb commented Aug 21, 2024

That's odd. I couldn't reproduce with:

  • python 3.6.8
  • pulp-cli 0.23.2
  • pulpcore 3.57.2
  • pulp_rpm 3.27.2

But since changing the client setup solves the issue, that should be moved to pulp-cli.

@ggainey ggainey transferred this issue from pulp/pulp_rpm Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage-Needed Needs to be reviewed at next pulp-cli mtg
Projects
None yet
Development

No branches or pull requests

2 participants