[openstack-dev] [all][OSC] OpenStack Interpreter: A useful tool python interpreter tool for the OpenStack client libraries.

Dean Troyer dtroyer at gmail.com
Wed May 3 15:20:33 UTC 2017


On Mon, May 1, 2017 at 11:11 PM, Adrian Turjak <adriant at catalyst.net.nz> wrote:
> As part of my dev work I recently put together a cool little tool which
> lets me have much easier access to the various OpenStack python clients
> in the scope of a python interpreter session. The first version was a
> little rough and without os-client-config support. The current version
> is now a plugin for the openstackclient and introduces a command that
> simply authenticates you, sets up the environment and helper tools, and
> then drops you into an ipython interactive session. The helper stuff is
> fairly simple, but combined with the features of ipython it really lets
> you start playing with the tools quickly, and by piggybacking onto
> openstackclient I get access to a lot of the niceties and inbuilt auth
> mechanisms.
>
> It is useful for learning, testing, or development against the various
> openstack client libraries, and even as an ops tool to quickly run some
> basic actions without having to resort to weird or silly bash command
> combinations.

This is at the other end of the spectrum of client usage from the CLI
in that it takes a very developer-like view of the APIs.  OSC has its
interactive mode (using cmd2) that is just a command loop without even
the ability to change global settings.  My hunch is that something in
between would be really useful, but I am not interested in creating
yet another DSL for this to include flow control and branching.

You mentioned Shade, which falls somewhere in between as it implements
a lot of logic to hide differences in clouds and ease dealing with
some of our API warts.  What would you think about producing a Python
mirror of the CLI interface with resource names, option names,
everything, but in Python.  I have not thought all the way through
this yet, but think we could take advantage of using the cliff command
classes and be able to re-use all of the bits already written.

This also magnifies the things we need to add to (or factor out of)
OSC to make it truly useful, such as manipulation of the global
options, maintaining multiple client contexts, etc.

Thanks for sharing!
dt

-- 

Dean Troyer
dtroyer at gmail.com



More information about the OpenStack-dev mailing list