opendevreview | Steve Baker proposed openstack/ansible-collections-openstack master: Include usable cloud config in app credential https://review.opendev.org/c/openstack/ansible-collections-openstack/+/913609 | 01:49 |
---|---|---|
opendevreview | Steve Baker proposed openstack/ansible-collections-openstack master: Add application_credential module https://review.opendev.org/c/openstack/ansible-collections-openstack/+/910463 | 03:33 |
ozzzo_work | Can anyone help with my sdk question? | 14:29 |
ozzzo_work | THis is what I'm trying: https://paste.openstack.org/show/bB6KnWy3qROZKbecmnp1/ | 14:30 |
diablo_rojo | stephenfin or gtema ^ ? | 14:30 |
diablo_rojo | ozzzo_work: trying to help you out :) I don't know the answer, but maybe they do. | 14:31 |
stephenfin | I've no idea how that 'connect_as' functionality works, I'm afraid. I've never used it | 14:31 |
gtema | the error says that you have not received proper auth | 14:32 |
gtema | problem with swift is that the endpoint has a different format and eventually "connect_as" is not going the full re-auth way respecting new endpoint format | 14:32 |
diablo_rojo | stephenfin: thanks for the response anyway! | 14:33 |
ozzzo_work | This is the output I get: https://paste.openstack.org/show/baZT5Biy8fSKQV33hygi/ | 14:34 |
gtema | you should try to change your script and enable debugging before doing auth ("openstack.enable_logging(debug=True)) | 14:35 |
gtema | with logging enabled you should see 2 things: reconnect causes going to keystone and fetching new token AND query to the swift with new project_id in the url | 14:36 |
ozzzo_work | ok trying that | 14:37 |
ozzzo_work | When I do stuff with my admin connection I get back "RESP" and "RESP BODY". The "usercloud = cloud.connect_as(project_id=project.id)" doesn't generate any debug output but the print statement after indicates that it worked | 14:46 |
ozzzo_work | After creating the usercloud connection with connect_as, and calling "container_list = usercloud.list_containers()" I get "Request returned failure status: 401" | 14:46 |
gtema | is the url list_containers result in correct or not? | 14:47 |
ozzzo_work | it llooks correct; it includes the customer project ID | 14:48 |
gtema | just to ensure: can you pls create a new clouds.yaml entry with admin creds and the desired project_id With that try to connect and list containers | 14:49 |
ozzzo_work | From CLI, when I access customer projects as admin, I export a new OS_AUTH_URL that includes the customer project ID instead of the admin project ID, and that works | 14:50 |
gtema | do not use osc, use sdk only | 14:51 |
gtema | they are not equals wrt swift | 14:51 |
ozzzo_work | oic you mean auth into Swift with the customer OS_AUTH_URL and then run the script? | 14:51 |
gtema | I mean clouds.yaml with admin creds and user_project_id set to the one you try to switch to | 14:52 |
ozzzo_work | I've never used a clouds.yaml; I have everything set in my env. I think I need to set OS_PROJECT_ID in my env | 14:56 |
gtema | then what is the project.id in your script? | 14:56 |
ozzzo_work | that's an input. I provide the project I want to check as a parameter | 14:58 |
gtema | then with all your initial env set OS_PROJECT_ID to that one you pass as input parameter and with SDK try to list containers | 14:59 |
gtema | its bad that you do not use clouds.yaml | 14:59 |
ozzzo_work | where can I find a document on how to use clouds.yaml? | 14:59 |
ozzzo_work | ok I found it; reading here: https://docs.openstack.org/python-openstackclient/train/configuration/index.html | 15:00 |
ozzzo_work | I'll experiment with this; thanks for your help! | 15:00 |
gtema | https://docs.openstack.org/openstacksdk/latest/user/guides/connect_from_config.html | 15:00 |
ozzzo_work | reading that also, ty! | 15:01 |
gtema | btw, pls try to change connect_as in your script to "connect_as(project={"id": project.id})" | 15:02 |
gtema | I suppose you are expected to pass a dict there and not just project_id | 15:02 |
gtema | you definitely need to pass an auth info as dict, so it's not project_id, but dict of project: {"id": XXX} | 15:15 |
gtema | ozzzo_work ^^^ | 15:16 |
ozzzo_work | Trying: usercloud = cloud.connect_as(project={"id": project.id}) | 15:17 |
ozzzo_work | That throws error: TypeError: __init__() got an unexpected keyword argument 'project' | 15:18 |
gtema | does it tell which line? | 15:19 |
ozzzo_work | urd. oy | 15:20 |
ozzzo_work | yes, it's the connect_as line | 15:20 |
ozzzo_work | if I do this: usercloud = cloud.connect_as(project_id={"project": project.id}) | 15:20 |
ozzzo_work | then it creates the usercloud connection and I'm back to "The request you have made requires authentication. " | 15:21 |
gtema | second invocation is clearly wrong | 15:22 |
gtema | and what if you do "connect_as_project({"id": XXX}) | 15:23 |
ozzzo_work | Back to "The request you have made requires authentication" | 15:26 |
ozzzo_work | I tried hardcoding the user project ID to replace XXX, and also: usercloud = cloud.connect_as_project({"id": project.id}) | 15:27 |
ozzzo_work | in both cases I see the usercloud connection created but then the container_list throws the auth error | 15:28 |
opendevreview | Merged openstack/ansible-collections-openstack master: Disable auto-discovery for setuptools https://review.opendev.org/c/openstack/ansible-collections-openstack/+/912772 | 15:45 |
opendevreview | Steve Baker proposed openstack/ansible-collections-openstack master: Add application_credential module https://review.opendev.org/c/openstack/ansible-collections-openstack/+/910463 | 18:16 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!