Hello, sorry for the late reply. I still have the same problem, it still asked username and password
when I use --header
option. My test environment is:
(venv) # pip list | grep pulp
pulp-cli 0.25.7
pulp-glue 0.25.7
"component": "core",
"version": "3.52.0",
"package": "pulpcore",
"module": "pulpcore.app",
"domain_compatible": true
"component": "rpm",
"version": "3.25.3",
"package": "pulp-rpm",
"module": "pulp_rpm.app",
"domain_compatible": true
@decko I donāt know if 0.25.7
is what you mean the the main branch
?
Here is the output of the test:
(venv) [root@xxxx ~]# pulp -vvv --header 'Authorization:Token xxxxx' user list
Username: tt
Password:
users_list : get https://xx.xx.xx/pulp/api/v3/users/?offset=0&limit=25
User-Agent: Pulp-CLI/0.25.7
Accept-Encoding: gzip, deflate
Accept: application/json
Connection: keep-alive
Authorization: Basic dHQ6dHQ=
Response: 401
Server: nginx/1.16.1
Date: Wed, 26 Jun 2024 19:51:30 GMT
Content-Type: application/json
Content-Length: 39
Connection: keep-alive
WWW-Authenticate: Token
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: 2854b41c45914256bc1f2632d164ffbf
Access-Control-Expose-Headers: Correlation-ID
{"detail":"Invalid username/password."}
Error: {"detail":"Invalid username/password."}
(venv) [root@xxx ~]# pulp -vvv --header 'Authorization: Token xxxxxx' user list
Username: tt
Password:
Traceback (most recent call last):
File "/root/venv/bin/pulp", line 8, in <module>
sys.exit(main())
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/root/venv/lib64/python3.9/site-packages/pulpcore/cli/common/generic.py", line 290, in invoke
return super().invoke(ctx)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/venv/lib64/python3.9/site-packages/pulpcore/cli/common/generic.py", line 290, in invoke
return super().invoke(ctx)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/venv/lib64/python3.9/site-packages/pulpcore/cli/common/generic.py", line 290, in invoke
return super().invoke(ctx)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/root/venv/lib64/python3.9/site-packages/pulpcore/cli/common/generic.py", line 1252, in callback
result = entity_ctx.list(limit=limit, offset=offset, parameters=kwargs)
File "/root/venv/lib64/python3.9/site-packages/pulp_glue/common/context.py", line 767, in list
result: t.Mapping[str, t.Any] = self.call("list", parameters=payload)
File "/root/venv/lib64/python3.9/site-packages/pulp_glue/common/context.py", line 704, in call
return self.pulp_ctx.call(
File "/root/venv/lib64/python3.9/site-packages/pulp_glue/common/context.py", line 357, in call
result = self.api.call(
File "/root/venv/lib64/python3.9/site-packages/pulp_glue/common/openapi.py", line 701, in call
request: requests.PreparedRequest = self.render_request(
File "/root/venv/lib64/python3.9/site-packages/pulp_glue/common/openapi.py", line 612, in render_request
request = self._session.prepare_request(
File "/root/venv/lib64/python3.9/site-packages/requests/sessions.py", line 486, in prepare_request
p.prepare(
File "/root/venv/lib64/python3.9/site-packages/requests/models.py", line 369, in prepare
self.prepare_headers(headers)
File "/root/venv/lib64/python3.9/site-packages/requests/models.py", line 491, in prepare_headers
check_header_validity(header)
File "/root/venv/lib64/python3.9/site-packages/requests/utils.py", line 1040, in check_header_validity
_validate_header_part(header, value, 1)
File "/root/venv/lib64/python3.9/site-packages/requests/utils.py", line 1056, in _validate_header_part
raise InvalidHeader(
requests.exceptions.InvalidHeader: Invalid leading whitespace, reserved character(s), or returncharacter(s) in header value: ' Token xxxxxxxxxxxxxxx'
Strange, same command , I did it several times, and once it says {"detail":"Invalid username/password."}
, Another time, it says requests.exceptions.InvalidHeader: Invalid leading whitespace, reserved character(s), or returncharacter(s) in header value: ' Token xxxxxxx'