Commit Graph

26 Commits

Author SHA1 Message Date
Brian Waldon 1e744f162e Replace httplib2 with httplib as http driver
* This allows us to send truly chunked responses to users
* Handle bad connection url schemes with a new InvalidEndpoint exception
* Fixes bug 1023240

Change-Id: I34500987f51d4e0c6e1f89ecf93853de3fcbb1c3
2012-07-23 13:52:12 -07:00
Brian Waldon 0f628b19cb Add pagination to v1 image-list
* Use recursive generator function to make subsequent requests
  to the v1 detailed images resource
* 'limit' continues to act as the absolute limit of images to return
  from a list call
* 'page_size' indicates how many images to ask for in each subsequent
  pagination request
* Expose --page-size through the cli
* Convert v1 images tests to use strict url comparison
* Drop strict_url_check from FakeAPI kwargs - now the functionality
  is always active and tests must directly match fixture urls
* Fix bug 1024614

Change-Id: Ifa7874d88360e03b5c8aa95bfb9d5e6dc6dc927e
2012-07-19 13:26:37 -07:00
Jenkins 570e64d91f Merge "Wrap image data in iterator" 2012-07-19 20:19:30 +00:00
Brian Waldon d88d8fc462 Add pagination to v2 image-list
* Use a recursive generator function to iterate over the image
  container. The presence of next links are indicators to
  continue pagination while their value drives the location of
  the next page.
* A user can pass in --page-size on the command line, or page_size
  when using the controller directly, to control how many images
  are requested with each subsequent paginated request. Default page
  size is 20.
* Add a flag (strict_url_check) for the FakeAPI class to control
  whether it chops off query params when trying to match a request
  to a fixture.
* Related to bp glance-client-v2.

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a12
2012-07-13 20:12:06 -07:00
Brian Waldon e5f038b62a Convert v2 images list method to generator
We will want this to be a generator as soon as we implement
pagination. Let's establish the interface now.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a07
2012-07-13 18:38:41 -07:00
Brian Waldon c398af18b0 Replace static v2 Image model with warlock model
* Add warlock v0.1.0 as a dependency
* Generate a pythonic, self-validating Image model using warlock
* Add raw method to Schema model
* Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a04
2012-07-13 18:38:41 -07:00
Brian Waldon b6cef9d145 Add support for viewing a single image through v2
* Add image-create command
* Add tests for Image model, Controller.get, and Controller.list
* Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a06
2012-07-13 18:38:40 -07:00
Brian Waldon f0445a1b44 Rewrite link parsing for finding v2 schemas
What we called 'links' are no longer returned in a container of
objects, they are top-level entity attribtues. This fixes the
parsing of the entities to look in the correct place when trying
to locate a specific schema.

Add a helper for printing to stderr and exiting with a non-zero
exit code.

Map 'name' to 'Attribute' when explaining a schema.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a05
2012-07-13 18:38:40 -07:00
Brian Waldon da360462a5 Wrap image data in iterator
This is establishing the API for a future optimization. We want to
be able to offer true socket-level caching, but can't do that with
httplib2 right now. For now, we will just fake the optimization
by returning an iterator over the image body, which happens to already
be fully loaded into a string.

Change-Id: I2d36e3cdd45b26d7c7c27ba050bf6a4b5765df6c
2012-07-11 19:55:02 -07:00
Brian Waldon cf8613e76d Preserve image properties on update
* By default, image properties should not be deleted on image update.
* A user can specify --purge-props through the CLI or purge_props
  as a keyword argument to ImageManager.update to override the default
  behavior and force properties to be deleted.
* Fixes bug 1022758

Change-Id: Ib079378cb765552fc29a66913aefbbcd934d2065
2012-07-09 21:03:46 -07:00
Brian Waldon a1691ddc10 Allow image filtering by custom properties
A user can filter a list of images by passing in a 'properties'
sub-dictionary inside of the 'filters' keyword argumen to
ImageManager.list(). The same functionality can be used through
the CLI through the use of one or more'--property-filter' options.

Related to bp glance-client-parity.

Change-Id: I7d119174d83faa894dde557e1944289de296a02c
2012-07-04 15:49:41 -07:00
Brian Waldon 99e872a57b Hook up GET /v1/images/<id>
This allows us to get raw image data out of the API! Related to
bp glance-client-parity

Change-Id: Id5f55553d2ff3b7bf58515062afdfd4b9b183a54
2012-06-21 13:06:18 -07:00
Brian Waldon 7f48506781 Add 'explain' command to v2 that describes schemas
At its core, this is adding the ability to finx a schema through
published links and convert it to a usable object.

Related to bp glance-client-v2

Change-Id: I7b38ad091c6b0ad80197eb789503cf73989893e5
2012-06-07 14:43:00 -07:00
Bhuvan Arumugam a1f8ea1c7f Auto generate AUTHORS file for glanceclient component.
Bug: 976267

Now that git commits are gated by CLA, we shouldn't enforce
committers to add an entry in AUTHORS file. The AUTHORS file
should be generated automatically, based on git commits.

This commit fixes the problem.

* AUTHORS
  Remove this file.

* .gitignore
  Add AUTHORS file.

* glanceclient/openstack/common/setup.py
  Sync changes from openstack-common.

* setup.py
  Generate AUTHORS file before creating the package.

* glanceclient/shell.py
  Pep8 fix.

* tests/test_authors.py
  Remove this test case.

Change-Id: I9e9d4da5ca3b147b483250dcf25a3b2a840123c2
2012-06-02 00:04:12 -07:00
Brian Waldon 3943699427 Refactor HTTPClient to use two request methods
Rather than depend on magic, I would prefer that we explicitly call
two different request methods: json_request and raw_request. The
former will encode/decode request bodies to and from JSON, while
the latter will not.

Change-Id: I6a429a5975993f71df85df55f11c5d51c050c289
2012-05-22 08:45:00 -07:00
Gabriel Hurley 3344eac545 Adds filter support to images.list().
This existed in glance.client, and should exist in the new
client as well! :-)

Change-Id: Iea8c55fcb0f0d30d6dc138072354c3f20d1288cf
2012-04-27 12:25:48 -07:00
Brian Waldon 1458d0ea85 Add AUTHORS test case
Change-Id: Ib81aee90fef3b2c101bb6b737e677339638b3cad
2012-04-03 20:18:53 -07:00
Brian Waldon 538a9e30a2 Adding id for image members 2012-04-03 19:26:38 -07:00
Brian Waldon c72e4dd2b5 image membership management works 2012-04-03 17:39:32 -07:00
Brian Waldon b87b1b5086 Adding support for passing image data through cli 2012-04-03 17:01:48 -07:00
Brian Waldon d191262413 Image update works 2012-04-03 16:00:49 -07:00
Brian Waldon d5bb951e5f More complete image creation 2012-04-03 14:43:04 -07:00
Brian Waldon d75a029a01 Adding shared-images support 2012-04-02 16:26:19 -07:00
Brian Waldon ca8434f2c3 Image members bones 2012-04-02 15:44:43 -07:00
Brian Waldon 664f370677 Basic testing 2012-04-02 14:08:03 -07:00
Brian Waldon c530de6389 Basic get/list operations work
* 'glance image-list' and 'glance image-show' work
* Set up tests, pep8, venv
2012-03-26 22:48:48 -07:00