Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

EndpointNotFound errors with Keystone v3 Python API

Using Juno...

I'm an operator trying to replace the crufty Essex era bash scripts we use for account registration with something saner. Using keystone v3 python api seems the right thing.

Keystone is serving v2 and v3. My 'identity' endoint points to v2 but Horizion uses v3 and I can access v3 vi the 'openstack' cli by specifying the right OS_AUTH_URL and OS_IDENTITY_API_VERSION=3

But...I cannot get my python script to do the right thing, it keeps failing with:

keystoneclient.openstack.common.apiclient.exceptions.EndpointNotFound

I maybe be casing things ion entirely the wrong direction, but I'm thinking this is because catalog endpoint is v2 (the failure is similar to passing the v3 OS_AUTH_URL but leaving out OS_IDENTITY_API_VERSION=3 in the CLI). If that's wrong you can probably stop reading and correct me right here :)

I'm following the example at http://docs.openstack.org/developer/python-keystoneclient/using-api-v3.html#authenticating-using-sessions

My specific case uses

os_auth = source(os_auth_file)
auth = v3.Password(auth_url=os_auth['OS_AUTH_URL'],
                   username=os_auth['OS_USERNAME'],
                   password=os_auth['OS_PASSWORD'],
                   project_domain_name='default',user_domain_name='default',
                   project_name=os_auth['OS_TENANT_NAME'])
sess = session.Session(auth=auth)
keystone = client.Client(session=sess)

That 'source' call parses the same shell script fragment I source to use v3 with python-openstackclient cli into the 'os_auth' list. these are admin credentials as I'm trying to manipulate users,projects, and quotas here. My stest case is:

keystone.users.list()

I expect a list of users, I get EndpointNotFound.

Trying to force my way through I created an 'identityv3' service and endpoint then specified

endpoint_filter={'service_type': 'identityv3',
                 'interface': 'public',
                 'region_name': 'RegionOne'}

in the session.Session call, which (mis)reading keystoneclient/session.py and http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html#service-discovery I though t I could put there, but apparently can't ( unexpected keyword argument).

Grasping at straws I moved the endpoint filter to the client.Client call and did not get and unexpected argument error but did still get the EndpointNotFound.

Can any one tell me where I went off the rails and how to get back on?

EndpointNotFound errors with Keystone v3 Python API

Using Juno...

I'm an operator trying to replace the crufty Essex era bash scripts we use for account registration with something saner. Using keystone v3 python api seems the right thing.

Keystone is serving v2 and v3. My 'identity' endoint points to v2 but Horizion uses v3 and I can access v3 vi the 'openstack' cli by specifying the right OS_AUTH_URL and OS_IDENTITY_API_VERSION=3

But...I cannot get my python script to do the right thing, it keeps failing with:

keystoneclient.openstack.common.apiclient.exceptions.EndpointNotFound

I maybe be casing things ion entirely the wrong direction, but I'm thinking this is because catalog endpoint is v2 (the failure is similar to passing the v3 OS_AUTH_URL but leaving out OS_IDENTITY_API_VERSION=3 in the CLI). If that's wrong you can probably stop reading and correct me right here :)

I'm following the example at http://docs.openstack.org/developer/python-keystoneclient/using-api-v3.html#authenticating-using-sessions

My specific case uses

os_auth = source(os_auth_file)
auth = v3.Password(auth_url=os_auth['OS_AUTH_URL'],
                   username=os_auth['OS_USERNAME'],
                   password=os_auth['OS_PASSWORD'],
                   project_domain_name='default',user_domain_name='default',
                   project_name=os_auth['OS_TENANT_NAME'])
sess = session.Session(auth=auth)
keystone = client.Client(session=sess)

That 'source' call parses the same shell script fragment I source to use v3 with python-openstackclient cli into the 'os_auth' list. these are admin credentials as I'm trying to manipulate users,projects, and quotas here. My stest case is:

keystone.users.list()

I expect a list of users, I get EndpointNotFound.

Trying to force my way through I created an 'identityv3' service and endpoint then specified

endpoint_filter={'service_type': 'identityv3',
                 'interface': 'public',
                 'region_name': 'RegionOne'}

in the session.Session call, which (mis)reading keystoneclient/session.py and http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html#service-discovery I though t I could put there, but apparently can't ( unexpected keyword argument).

Grasping at straws I moved the endpoint filter to the client.Client call and did not get and unexpected argument error but did still get the EndpointNotFound.

Can any one tell me where I went off the rails and how to get back on?

EndpointNotFound errors with Keystone v3 Python API

Using Juno...

I'm an operator trying to replace the crufty Essex era bash scripts we use for account registration with something saner. Using keystone v3 python api seems the right thing.

Keystone is serving v2 and v3. My 'identity' endoint points to v2 but Horizion uses v3 and I can access v3 vi the 'openstack' cli by specifying the right OS_AUTH_URL and OS_IDENTITY_API_VERSION=3

But...I cannot get my python script to do the right thing, it keeps failing with:

keystoneclient.openstack.common.apiclient.exceptions.EndpointNotFound

I maybe be casing things ion entirely the wrong direction, but I'm thinking this is because catalog endpoint is v2 (the failure is similar to passing the v3 OS_AUTH_URL but leaving out OS_IDENTITY_API_VERSION=3 in the CLI). If that's wrong you can probably stop reading and correct me right here :)

I'm following the example at http://docs.openstack.org/developer/python-keystoneclient/using-api-v3.html#authenticating-using-sessions

My specific case uses

os_auth = source(os_auth_file)
auth = v3.Password(auth_url=os_auth['OS_AUTH_URL'],
                   username=os_auth['OS_USERNAME'],
                   password=os_auth['OS_PASSWORD'],
                   project_domain_name='default',user_domain_name='default',
                   project_name=os_auth['OS_TENANT_NAME'])
sess = session.Session(auth=auth)
keystone = client.Client(session=sess)

That 'source' call parses the same shell script fragment I source to use v3 with python-openstackclient cli into the 'os_auth' list. these are admin credentials as I'm trying to manipulate users,projects, and quotas here. My stest case is:

keystone.users.list()

I expect a list of users, I get EndpointNotFound.

Trying to force my way through I created an 'identityv3' service and endpoint then specified

endpoint_filter={'service_type': 'identityv3',
                 'interface': 'public',
                 'region_name': 'RegionOne'}

in the session.Session call, which (mis)reading keystoneclient/session.py and http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html#service-discovery I though t I could put there, but apparently can't ( unexpected keyword argument).

Grasping at straws I moved the endpoint filter to the client.Client call and did not get and unexpected argument error but did still get the EndpointNotFound.

If I make a more direct call (after including the above) I can get a user list...

>>> resp = sess.get('/users', endpoint_filter={'service_type': 'identityv3',
...                  'interface': 'public',
...                  'region_name': 'RegionOne'})

now resp.content has a list of users, why does this work and keystone.users.list() fail?

Can any one tell me where I went off the rails and how to get back on?

EndpointNotFound errors with Keystone v3 Python API

Using Juno...

I'm an operator trying to replace the crufty Essex era bash scripts we use for account registration with something saner. Using keystone v3 python api seems the right thing.

Keystone is serving v2 and v3. My 'identity' endoint points to v2 but Horizion uses v3 and I can access v3 vi the 'openstack' cli by specifying the right OS_AUTH_URL and OS_IDENTITY_API_VERSION=3

But...I cannot get my python script to do the right thing, it keeps failing with:

keystoneclient.openstack.common.apiclient.exceptions.EndpointNotFound

I maybe If I switch my identity enpoint to be casing things ion entirely the wrong direction, explicity /v3 then everything works but I'm thinking this my understanding is because catalog endpoint is v2 (the failure is similar to passing the v3 OS_AUTH_URL but that leaving out OS_IDENTITY_API_VERSION=3 in the CLI). If that's wrong you can probably stop reading and correct me right here :)it a /v2.0 for the majority version 2 clients should work with newer clients being able to do discovery.

I'm following the example at http://docs.openstack.org/developer/python-keystoneclient/using-api-v3.html#authenticating-using-sessions

My specific case uses

from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client

from os import environ
from subprocess import Popen, PIPE, call, check_output, check_call

#interactive-fu
import rlcompleter, readline
readline.parse_and_bind('tab: complete')

debug=True
os_auth_file='/etc/openrcV3' #where to find authentication bits

def source(script, update=True, clean=True):
    """
    Source variables from a shell script
    import them in the environment (if update==True)
    and report only the script variables (if clean==True)
    """

    global environ
    if clean:
        environ_back = dict(environ)
        environ.clear()

        pipe = Popen(". %s; env" % script, stdout=PIPE, shell=True)
        data = pipe.communicate()[0]

        env = dict((line.split("=", 1) for line in data.splitlines()))

    if clean:
        # remove unwanted minimal vars
        env.pop('LINES', None)
        env.pop('COLUMNS', None)
        environ = dict(environ_back)

    if update:
        environ.update(env)

    return env 

os_auth = source(os_auth_file)
 auth = v3.Password(auth_url=os_auth['OS_AUTH_URL'],
                   username=os_auth['OS_USERNAME'],
                   password=os_auth['OS_PASSWORD'],
                   project_domain_name='default',user_domain_name='default',
                   project_name=os_auth['OS_TENANT_NAME'])
sess = session.Session(auth=auth)
session.Session(auth=auth) 

keystone = client.Client(session=sess)
client.Client(version='v3',session=sess)
users=keystone.users.list()
print users

The addion of version='v3' to the 'client.Client' call is not in the docs but was suggested by Adma Young on IRC and got the code to 'work for him' but oddly makes no change for me.

That 'source' call parses the same shell script fragment I source to use v3 with python-openstackclient cli into the 'os_auth' list. these are admin credentials as I'm trying to manipulate users,projects, and quotas here. cli. My stest test case is:

keystone.users.list()

I expect a list of users, I get EndpointNotFound.

Trying to force my way through I created an 'identityv3' service and endpoint then specified

endpoint_filter={'service_type': 'identityv3',
                 'interface': 'public',
                 'region_name': 'RegionOne'}

in the session.Session call, which (mis)reading keystoneclient/session.py and http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html#service-discovery I though t I could put there, but apparently can't ( unexpected keyword argument).

Grasping at straws I moved the endpoint filter to the client.Client call and did not get and unexpected argument error but did still get the EndpointNotFound.

If I make a more direct call (after including the above) I can get a user list...

>>> resp = sess.get('/users', endpoint_filter={'service_type': 'identityv3',
...                  'interface': 'public',
...                  'region_name': 'RegionOne'})

now resp.content has a list of users, why does this work and keystone.users.list() fail?

Can any one tell me where I went off the rails and how to get back on?