[openstack-dev] [heat][python-heatclient] Does python-heatclient works with keystone sessions?

Ian Cordasco ian.cordasco at RACKSPACE.COM
Thu May 7 21:31:14 UTC 2015



On 5/7/15, 14:43, "Jay Reslock" <jreslock at gmail.com> wrote:

>Hi,
>This is my first mail to the group.  I hope I set the subject correctly
>and that this hasn't been asked already.  I searched archives and did not
>see this question asked or answered previously.
>
>
>I am working on a client thing that uses the python-keystoneclient and
>python-heatclient api bindings to set up an authenticated session and
>then use that session to talk to the heat service.  This doesn't work for
>heat but does work for other services
> such as nova and sahara.  Is this because sessions aren't supported in
>the heatclient api yet?
>
>
>sample code:
>
>
>https://gist.github.com/jreslock/a525abdcce53ca0492a7
>
>
>
>I'm using fabric to define tasks so I can call them via another tool.
>When I run the task I get:
>
>
>TypeError: Client() takes at least 1 argument (0 given)
>
>
>
>The documentation does not say anything about being able to pass session
>to the heatclient but the others seem to work.  I just want to know if
>this is intended/expected behavior or not.
>
>
>-Jason
>


Hey Jason,

Welcome to the list. There's a critical difference in the different
Client's that you import. In the rest of the examples you import from
foo.v2.client. In this case, you're importing heatclient.client. Since
heat's API is versioned, heatclient.client.Client is expecting a string
like 'v1' to be passed like

    Client(version='v1', session=sess)

Alternatively, you can just do

    from heatclient.v1 import client as heat_v1
    heat = heat_v1.Client(session=sess)

Note, there is no v2 in heatclient.

Cheers,
Ian



More information about the OpenStack-dev mailing list