pulp / pulp-cli-deb

2 stars 11 forks source link

pulp cli is working only with basic authentication and not with Remote User authentication #53

Closed vigneshrajap closed 1 year ago

vigneshrajap commented 1 year ago

There seems to be a slight difference between extracting information using Basic authentication and using Remote User authentication. I have attached both examples.

http --auth username:password $BASE_ADDR/pulp/api/v3/repositories/deb/apt/

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 1814
Content-Type: application/json
Correlation-ID: 736c888b0b0a4b2c984f6f37f2abd704
Date: Tue, 02 May 2023 08:38:07 GMT
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

{
    "count": 4, 
    "next": null, 
    "previous": null, 
    "results": [
    {
    }
    ]
}

http --cert $cert --cert-key $cert_key $BASE_ADDR/pulp/api/v3/repositories/deb/apt/

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 2207
Content-Type: application/json
Correlation-ID: 77ff67ea59944ae5a5074fffa9d2362f
Date: Tue, 02 May 2023 08:37:16 GMT
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

[
    {
    }
]

Due to this difference, pulp cli deb is throwing error since it tries to access data through "results"

pulp deb repository list

 File "/home/xx/.local/lib/python3.6/site-packages/pulp_glue/common/context.py", line 608, in list
    count = result["count"]
TypeError: list indices must be integers or slices, not str
mdellweg commented 1 year ago

Can you tell whether this is true for all pulp endpoints? From the looks of it, it may not even be an issue with the cli...

vigneshrajap commented 1 year ago

@mdellweg pulp status and pulp orphan cleanup still work with Remote user authentication but anything with pulp deb ** does not work.

ggainey commented 1 year ago

Based on the http output, pulp-cli isn't the problem here, it's something on the server-side.

@vigneshrajap status and orphan-cleanup aren't list-endpoints, so I don't think they're helping us pin this down. On your system, what does http --cert $cert --cert-key $cert_key $BASE_ADDR/pulp/api/v3/artifacts/ return? If it's a "typical" list-response (count/next/prev/results), then it "feels like" the pulp_deb repo-list REST API is the more-likely culprit.

vigneshrajap commented 1 year ago

@ggainey Yes I agree, the issue seems to be on the server side. but I am not sure where I should ask about it.

http --cert $cert --cert-key $cert_key $BASE_ADDR/pulp/api/v3/artifacts/ could not be accessed and it outputs as "detail": "Authentication credentials were not provided."

Some configuration for remote user authentication has been set incorrectly I believe. Thanks for the help, i will close the issue.

ggainey commented 1 year ago

@vigneshrajap you can always hit us up in #pulp in Matrix, or open a thread in discourse: