Add the module name to the repr string so we can better identify
the resource that created the string. This is also convenient
for recreating the object from a string such as:
python examples/get.py openstack/compute/v2/server.py --data "openstack.compute.v2.server.Server(attrs={u'id': u'85d8ecf3-3757-43fd-b7a2-eb6636f7af1c', u'name': u'jenkins'}, loaded=True)"
Change-Id: I7a8bdabd8150e0bd06ec46deecf81eaa126907ab
This patch enables TRUST_ID based authentication for users to try
the examples. Without this, users won't be aware of this important
parameter/feature.
Change-Id: Ide409c91d8c0530aebaef3b2682997533b639f6c
The --data option to the examples expects json. I don't know why I ever did that, it is inconvenient. I want to be able to cut and past Python repred data structures into --data and have them available to the example code. No more converting ' to ".
Closes-Bug: 1425678
Change-Id: I96ba80dd4018ec6834f02ac4a4902f3bab875870
This will greatly reduce the number of ksc to sdk differences.
Why fight it, everyone is used to username anyway.
Change-Id: Ie6e897c1baa3184af77510b98790196e8f069f5a
This change moves the ability to enable logging out of the
examples.common module and into the openstack.utils since it is
generally useful.
This is intended to give users a short-term solution to receive
debugging messages. If they want to always have our messages logged in
their application they should create their own logging handler(s) with
their own format, and that will cause our messages to be sent to their
handlers as they wish.
https://bugs.launchpad.net/python-openstacksdk/+bug/1418307 is open to
track the documentation aspect of this.
Change-Id: Ic8768d529d0389b9b04bd4ea31453a82f30faf33
It wasn't possible to call examples.get without a --data parameter. This
change checks if the opts.data is empty, and if so, just deals with it.
Change-Id: I262e8f8b061d163e478c3b9fe611a44180119909
Move the version detection code into a plugin because it
does not belong in connection. Create a new discoverable plugin
that looks at the auth_url and makes a best guess if it should
use v2 or v3 auth.
The plugin also now accepts access_info so a cached version
of the authorization can be reproduced without hitting
keystone.
Change-Id: Ia5d32457c90716627a75be2c99267c4ed7903197
Also, change around the other examples to use the connection
example so there isn't duplication of code for session and
authentication.
Change-Id: I90dbcfac3eae0c792bd9c4eae071de7d81e1b27d
Add a user preference class to collect user service preferences.
Sorry for all the test changes. I wanted to make the v2 and v3
tests have the same service catalog in a different format so that
the normalize catalog would be the same for both.
Closes-Bug: #1353030
Change-Id: Ice4e606255533425be7559916f083b4171566502
The connection class can be made with a transport and/or authenticator
that was already constructed or it can be made with nothing. The
create method will create a transport, authenticator and session if
they are needed. The normal use case would look something like:
conn = connection.Connection(**auth_args)
Change-Id: I27573bce799d9992748967b5ea1b575139a75853
The requests.Session object that transport derives from has
this overloaded meaning for verify that is causing awkwardness
around our code. I've moved the ugly to the examples/common.py
argument parsing.
Change-Id: I3e8f5311eeba6108d3ea086a01b71663401a52fa
I would like to extract the arguments automatically from the
example command line arguments. If the names matched, it would
be much easier.
Change-Id: I0877fe8a0b6f5a61505fdecddd2f72ee8c505d29
I was having trouble authenticating with devstack identity v3 without domain.
These options make it possible.
Change-Id: I2a968a89136e72898dc086b8f5330608c31ec66f
Dolph made a comment a while back saying region_name should be
region which I did. Talked with Dean about this and he dug
his heels in saying it should be region_name. All the CLIs
are using region_name.
Change-Id: I212eb4ec96a59650226ae5f5b0172c40c25dec90
Allow the user to pass UUID only instead of full json. This will
be handy for get and delete. For example:
python -m examples.get openstack/network/v2/network.py \
--data ab13c9e7-3f30-4eee-9f96-41deb0223183
Change-Id: I12f15728b908d21110e9dead857d24d903bf17a9
Example create command and new --data option for examples. For
example:
python -m examples.create openstack/network/v2_0/network.py \
--data '{"name": "foo"}'
Change-Id: Ie048f0e7d31b25e8c3df79a59d3cd73f4ce2b1b2
The find_resource_cls method can be used by several commands to
locate a resource. It may be called with a file name or import
path.
Change-Id: Ia83c9e6c1a9745088c3558bfbef32d4a4ca234b2
Some important changes for service filtering to support resources:
* Support the notion of ANY service_type in the service filter for
user preferences.
* Create a join method in ServiceFilter to join a resource
filter with a user preference.
* Support service filter preference in session.
For example if a user wanted to use region='East' they would create
a service filter preference in their session with that region and
use that session with any resource.
Change-Id: I13fc2838b66ec85bdd0191c78b27b3cd685a8322
A slight reorganization on the example code to avoid conflicts
and make it clearer how to use the example code:
* Move transport code out of common.py to transport.py
* Try to keep example code in silos of functionality to avoid
conflicts (transport.py, authenticate.py, ...)
For the authentication examples:
* Added basic identity v2 and v3 authentication command
To run:
python -m examples.authenticate
python -m examples.transport https://region-a.geo-1.identity.hpcloudsvc.com:35357/
Change-Id: I3f342409a7df645bfed82963488b665e1fb191e7
This is a very basic starting point for working code example usage of
the SDK.
The common module includes an argument parser that recognizes the common
authentication arguments so setting up auth against a running OpenStack
cloud is the same as the library CLIs.
The inital example for Transport is a couple of simple GETs that also
shows the connection pooling.
Change-Id: I07de2888471a39cbc43daedded36ad683d02a472