Wednesday, 2024-03-20

opendevreviewSteve Baker proposed openstack/ansible-collections-openstack master: Include usable cloud config in app credential  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/91360901:49
opendevreviewSteve Baker proposed openstack/ansible-collections-openstack master: Add application_credential module  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/91046303:33
ozzzo_workCan anyone help with my sdk question?14:29
ozzzo_workTHis is what I'm trying: https://paste.openstack.org/show/bB6KnWy3qROZKbecmnp1/14:30
diablo_rojostephenfin or gtema ^ ?14:30
diablo_rojoozzzo_work: trying to help you out :) I don't know the answer, but maybe they do. 14:31
stephenfinI've no idea how that 'connect_as' functionality works, I'm afraid. I've never used it14:31
gtemathe error says that you have not received proper auth14:32
gtemaproblem 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 format14:32
diablo_rojostephenfin: thanks for the response anyway! 14:33
ozzzo_workThis is the output I get: https://paste.openstack.org/show/baZT5Biy8fSKQV33hygi/14:34
gtemayou should try to change your script and enable debugging before doing auth ("openstack.enable_logging(debug=True))14:35
gtemawith 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 url14:36
ozzzo_workok trying that14:37
ozzzo_workWhen 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 worked14:46
ozzzo_workAfter creating the usercloud connection with connect_as, and calling "container_list = usercloud.list_containers()" I get "Request returned failure status: 401"14:46
gtemais the url list_containers result in correct or not?14:47
ozzzo_workit llooks correct; it includes the customer project ID14:48
gtemajust 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 containers14:49
ozzzo_workFrom 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 works14:50
gtemado not use osc, use sdk only14:51
gtemathey are not equals wrt swift14:51
ozzzo_workoic you mean auth into Swift with the customer OS_AUTH_URL and then run the script?14:51
gtemaI mean clouds.yaml with admin creds and user_project_id set to the one you try to switch to14:52
ozzzo_workI've never used a clouds.yaml; I have everything set in my env. I think I need to set OS_PROJECT_ID in my env14:56
gtemathen what is the project.id in your script?14:56
ozzzo_workthat's an input. I provide the project I want to check as a parameter14:58
gtemathen with all your initial env set OS_PROJECT_ID to that one you pass as input parameter and with SDK try to list containers14:59
gtemaits bad that you do not use clouds.yaml14:59
ozzzo_workwhere can I find a document on how to use clouds.yaml?14:59
ozzzo_workok I found it; reading here: https://docs.openstack.org/python-openstackclient/train/configuration/index.html15:00
ozzzo_workI'll experiment with this; thanks for your help!15:00
gtemahttps://docs.openstack.org/openstacksdk/latest/user/guides/connect_from_config.html15:00
ozzzo_workreading that also, ty!15:01
gtemabtw, pls try to change connect_as in your script to "connect_as(project={"id": project.id})"15:02
gtemaI suppose you are expected to pass a dict there and not just project_id15:02
gtemayou definitely need to pass an auth info as dict, so it's not project_id, but dict of project: {"id": XXX}15:15
gtemaozzzo_work ^^^15:16
ozzzo_workTrying: usercloud = cloud.connect_as(project={"id": project.id})15:17
ozzzo_workThat throws error: TypeError: __init__() got an unexpected keyword argument 'project'15:18
gtemadoes it tell which line?15:19
ozzzo_workurd. oy15:20
ozzzo_workyes, it's the connect_as line15:20
ozzzo_workif I do this: usercloud = cloud.connect_as(project_id={"project": project.id})15:20
ozzzo_workthen it creates the usercloud connection and I'm back to "The request you have made requires authentication. "15:21
gtemasecond invocation is clearly wrong15:22
gtemaand what if you do "connect_as_project({"id": XXX})15:23
ozzzo_workBack to "The request you have made requires authentication"15:26
ozzzo_workI tried hardcoding the user project ID to replace XXX, and also: usercloud = cloud.connect_as_project({"id": project.id})15:27
ozzzo_workin both cases I see the usercloud connection created but then the container_list throws the auth error15:28
opendevreviewMerged openstack/ansible-collections-openstack master: Disable auto-discovery for setuptools  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/91277215:45
opendevreviewSteve Baker proposed openstack/ansible-collections-openstack master: Add application_credential module  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/91046318:16

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!