Go to file
Brian Curtin 586d9afdab Allow alternate_id to be accessed directly
When a Resource has an alternate_id but not a primary id, its usage is a
bit inconsistent. While we make things work internally, such as when you
do a Resource.get call where we find the alternate_id, you still can't
just call foo.id and get a valid ID back.

The Keypair resource in compute is one of these examples, and its
functional tests are currently failing because they depend on
passing in "sot.id". While they could be engineered around that,
it's certainly a valid usecase to support, and this change
enables it. It does so by implementing __getattribute__ on the Resource
class and then special-casing a request for the "id" name. First we try
to get the primary "id" directly, and if nothing happens there then we
try to get an alternate_id.

Additionally, this changes the special case in the Resource.create
method that was handling any create call with an existing ID as
requiring that it go through the PUT branch when id exists. Relying on
the id value itself being set for determining that branching is
problematic in that these alternate_id resources would then trigger that
path, sending creates which must happen by POST into the PUT branch just
because their alternate_id becomes additionally known as the canonical
id. Instead, we now have put_create as the special case, which is a
fairly rare case as it stands. At least object_store will need to have
its resources set with that flag once it is converted over, though there
may be others as well.

Change-Id: Ia1fd1782f4ad8fa856c16d75bba4d8931307a6e7
2016-06-30 11:37:47 -04:00
2016-06-29 14:40:39 +00:00
2015-07-18 09:55:48 -06:00
2015-10-17 22:37:27 +00:00
2015-05-22 17:19:16 -07:00
2015-12-09 07:24:37 -07:00
2015-12-16 14:51:40 -06:00
2015-12-23 01:31:15 +00:00
2015-09-21 14:44:17 +00:00
2016-04-25 06:18:52 -05:00

OpenStack Python SDK

The python-openstacksdk is a collection of libraries for building applications to work with OpenStack clouds. The project aims to provide a consistent and complete set of interactions with OpenStack's many services, along with complete documentation, examples, and tools.

This SDK is under active development, and in the interests of providing a high-quality interface, the APIs provided in this release may differ from those provided in future release.

Usage

The following example simply connects to an OpenStack cloud and lists the containers in the Object Store service.:

from openstack import connection
conn = connection.Connection(auth_url="http://openstack:5000/v3",
                             project_name="big_project",
                             username="SDK_user",
                             password="Super5ecretPassw0rd")
for container in conn.object_store.containers():
   print(container.name)

Documentation

Documentation is available at http://developer.openstack.org/sdks/python/openstacksdk/

License

Apache 2.0

Description
RETIRED, further work has moved to Debian project infrastructure
Readme 3 MiB