Well, after doing some more reading on the auth types, I think 
3.x_oidc_access_token is not what you want.  I don't know how to authenticate 
using v3oidcpassword with Libcloud.  Sorry, good luck!

On 6/2/21, 11:37 PM, "Massimo Canonico" <massimo.canon...@uniupo.it> wrote:

    Caution: This email is from an external sender. Please do not click links 
or open attachments unless you recognize the sender and know the content is 
safe. Forward suspicious emails to isitbad@.



    Thank you Dan.

    Looking at the documentation, I'm not sure how I can properly use this
    parameter.

    Looking in internet, I read that I should create a token by using this
    command: "openstack token issue" but not use how can use it and if it is
    really necessary.

    I'm attaching my openrc file provided by Horizon dashboard, if you can
    figure out what I'm missing here.

    Currently this code is not working:


    from libcloud.compute.types import Provider
    from libcloud.compute.providers import get_driver

    username = 'mcanonic'
    password = '<MYPASSW>'
    project_name = 'CCC-19/20' # It looks like CH-XXXXX
    #project_name = 'CH-822574' # It looks like CH-XXXXX

    auth_url = 'https://kvm.tacc.chameleoncloud.org:5000'  # It looks like
    https://kvm.tacc.chameleoncloud.org:5000
    region_name = 'KVM@TACC' # It looks like KVM@TACC

    cls = get_driver(Provider.OPENSTACK)
    client = cls(username,
             #password,
             api_version='2.1',
             ex_tenant_name=project_name,
             ex_force_auth_url=auth_url,
             ex_force_service_region=region_name,
             ex_force_auth_version='3.x_oidc_access_token')

    After my signature the error that I got.

    Thanks for your support,

    Massimo.

    [mex@hope code]$ python libcloudOS-mcanonic2.py
    /home/mex/.local/lib/python3.8/site-packages/requests/__init__.py:89:
    RequestsDependencyWarning: urllib3 (1.26.5) or chardet (3.0.4) doesn't
    match a supported version!
       warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
    Traceback (most recent call last):
       File "libcloudOS-mcanonic2.py", line 42, in <module>
         instances = client.list_nodes()
       File
    
"/home/mex/.local/lib/python3.8/site-packages/libcloud/compute/drivers/openstack.py",
    line 2906, in list_nodes
         return self._to_nodes(self._paginated_request(
       File
    
"/home/mex/.local/lib/python3.8/site-packages/libcloud/compute/drivers/openstack.py",
    line 200, in _paginated_request
         data = connection.request(url, params=params)
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/openstack.py",
    line 232, in request
         return super(OpenStackBaseConnection, self).request(action=action,
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/base.py",
    line 555, in request
         action = self.morph_action_hook(action)
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/openstack.py",
    line 304, in morph_action_hook
         self._populate_hosts_and_request_paths()
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/openstack.py",
    line 338, in _populate_hosts_and_request_paths
         osa = osa.authenticate(**kwargs)  # may throw InvalidCreds
       File
    
"/home/mex/.local/lib/python3.8/site-packages/libcloud/common/openstack_identity.py",
    line 1431, in authenticate
         subject_token = self._get_unscoped_token_from_oidc_token()
       File
    
"/home/mex/.local/lib/python3.8/site-packages/libcloud/common/openstack_identity.py",
    line 1512, in _get_unscoped_token_from_oidc_token
         response = self.request(path,
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/base.py",
    line 655, in request
         response = responseCls(**kwargs)
       File
    "/home/mex/.local/lib/python3.8/site-packages/libcloud/common/base.py",
    line 165, in __init__
         raise exception_from_message(code=self.status,
    libcloud.common.exceptions.BaseHTTPError: <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 3.2 Final//EN">
    <title>404 Not Found</title>
    <h1>Not Found</h1>
    <p>The requested URL was not found on the server. If you entered the URL
    manually please check your spelling and try again.</p>








    On 6/2/21 11:23 PM, Dan Peschman wrote:
    > Hello.  Just guessing here, is 3.x_oidc_access_token what you want for 
ex_force_auth_version?
    > https://libcloud.readthedocs.io/en/stable/compute/drivers/openstack.html
    >
    > Dan
    >
    > On 6/2/21, 1:01 PM, "Massimo Canonico" <massimo.canon...@uniupo.it> wrote:
    >
    >      Caution: This email is from an external sender. Please do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. Forward suspicious emails to isitbad@.
    >
    >
    >
    >      Hi,
    >
    >      I'm using the openstack cloud provided by chameleon project and they 
use
    >      the v3oidcpassword.
    >
    >      After my signature, I paste the script that I'm trying to use but it
    >      does not work.
    >
    >      Do you have any suggestion in order to have libcloud working? I read
    >      something related to "openstack token issue" trick but I'm not sure 
how
    >      to use id and user_id provided by the previous command inside my 
script.
    >
    >      Thank in advance,
    >
    >      Massimo
    >
    >      from libcloud.compute.types import Provider
    >      from libcloud.compute.providers import get_driver
    >
    >      auth_username = 'mcanonic'
    >      auth_password = '<MY_PASSOWORD>'
    >      project_name = 'CCC-19/20'
    >
    >      auth_url = 'https://kvm.tacc.chameleoncloud.org:5000'
    >      region_name = 'KVM@TACC'
    >
    >      provider = get_driver(Provider.OPENSTACK)
    >      conn =
    >      
provider(auth_username,auth_password,ex_force_auth_url=auth_url,ex_force_auth_version='3.x_password',ex_tenant_name=project_name,ex_force_service_region=region_name,api_version='2.1')
    >
    >      instances = conn.list_nodes()
    >
    >      i = 1
    >      for instance in instances:
    >           print(i,"):",instance.name)
    >           i += 1
    >
    >

Reply via email to