endpoint_type should be defaulted to 'publicURL' troveclient.v1.client.Client

Bug #1409982 reported by Edmond Kotowski on 2015-01-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Medium
Edmond Kotowski

Bug Description

When trying to create a troveclient it will raise an exception when endpoint_type is not explicitly set to "publicURL"

from troveclient.v1 import client

trove_client = client.Client(os.environ["OS_USERNAME"],
                             os.environ["OS_PASSWORD"],
                             project_id=os.environ["OS_TENANT_NAME"],
                             auth_url=os.environ["OS_AUTH_URL"])

trove_client.instances.list()

This will raise a AuthorizationFailure
    292 except KeyError:
--> 293 raise exceptions.AuthorizationFailure()
    294 except exceptions.EndpointNotFound:
    295 print("Could not find any suitable endpoint. Correct region?")

Code below will be successful:

from troveclient.v1 import client

trove_client = client.Client(os.environ["OS_USERNAME"],
                             os.environ["OS_PASSWORD"],
                             project_id=os.environ["OS_TENANT_NAME"],
                             auth_url=os.environ["OS_AUTH_URL"],
                             endpoint_type="publicURL")

print trove_client.instances.list()

The reason for this is the troveclient.v1.client.Client explicitly sets endpoint_type = None while troveclient.client.HTTPClient sets endpoint_type='publicURL' which gets overwritten with None when not explicitly setting the value.

Fix will be to set endpoint_type='publicURL' in troveclient.v1.client.Client __init__ method.

Also documentation is out of date for creating a troveclient using the python API bindings.

Changed in trove:
assignee: nobody → Edmond Kotowski (ekotowski)
summary: - endpoint_type should be defaulted to "publicURL" in
- troveclient.client.Client and troveclient.v1.client.Client
+ endpoint_type should be defaulted to "publicURL"
+ troveclient.v1.client.Client
description: updated
description: updated
summary: - endpoint_type should be defaulted to "publicURL"
+ endpoint_type should be defaulted to 'publicURL'
troveclient.v1.client.Client
Changed in trove:
importance: Undecided → Medium
Changed in trove:
status: New → Fix Committed
Changed in trove:
milestone: none → kilo-2
milestone: kilo-2 → next
Changed in trove:
milestone: next → kilo-3
milestone: kilo-3 → ongoing
Changed in trove:
status: Fix Committed → Fix Released

This issue was fixed in the openstack/python-troveclient 1.0.9 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers