Heatclient should be easier to use via python

Bug #1646539 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
Fix Released
Medium
Rabi Mishra

Bug Description

Some/many other clients provide an easy way to create a Client object without direct interaction with keystone, e.g novaclient allows this:

from novaclient import client
nova = client.Client(VERSION, USERNAME, PASSWORD, PROJECT_ID, AUTH_URL)

http://docs.openstack.org/developer/python-novaclient/api.html#usage

For heat it's more like this:

from heatclient import client as heatclient
from keystoneclient.v3 import client

c = client.Client(debug=DEBUG,
                  username=OS_USERNAME,
                  password=OS_PASSWORD,
                  project_name=OS_TENANT_NAME,
                  auth_url=OS_AUTH_URL)
endpoint = c.service_catalog.url_for(service_type='orchestration',
                                      endpoint_type='publicURL')
heat = heatclient.Client('1', endpoint, token=c.auth_token)

It would be convenient if we allowed folks to pass the auth_url directly to the heatclient.Client constructor and did this work of getting the token/endpoint for them.

Relatedly I don't think it's possible to create a keystoneclient session object and reuse it with heatclient, so it'd be good to fix that too.

Steven Hardy (shardy)
Changed in python-heatclient:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Rabi Mishra (rabi) wrote :

I think it's possible to use session with heatclient.

>>>heat = client.Client(VERSION, session=sess, service_type='orchestration').

Though we can default the service_type, if not specified like other clients. I've pushed a patch to fix that.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/405766

Changed in python-heatclient:
assignee: nobody → Rabi Mishra (rabi)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/405766
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=ebb92f1acc29cbc20f891b906f247f51906a1124
Submitter: Jenkins
Branch: master

commit ebb92f1acc29cbc20f891b906f247f51906a1124
Author: rabi <email address hidden>
Date: Fri Dec 2 08:37:22 2016 +0530

    Use default service_type with session

    At present when using session with heatclient, you've to
    specify the service_type. Use the only service_type
    'orchestration', if not specified.

    Change-Id: I994698784e5b30471f6d863034fa21aa8963fd9f
    Partial-Bug: #1646539

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/408458

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/408458
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=3d60183120ca709e4298fa516bc1c7b639db770b
Submitter: Jenkins
Branch: master

commit 3d60183120ca709e4298fa516bc1c7b639db770b
Author: rabi <email address hidden>
Date: Thu Dec 8 12:48:58 2016 +0530

    Fix doc on keystoneauth session api usage

    This fixes documentation on client creation with keystoneauth
    session api.

    Change-Id: I0f6bb6f4f9bbaa84b5185c0a9e9db6a4184702d4
    Partial-Bug: #1646539

Rabi Mishra (rabi)
Changed in python-heatclient:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.