By introducing the parameter --human-readable for several functions
(image-list, image-show, image-update, image-create) it's possible
to convert the size in bytes to something more readable like
9.309MB or 1.375GB.
Change-Id: I4e2654994361dcf330ed6d681dbed73388f159cb
Use pyOpenSSL for HTTPS connections.
This allows:
* Neater loading of system CA files
* Optional disabling of SSL compression
The performance gain from disabling SSL compression is significant
in cases where the image being uploaded/downloaded is in an already
compressed format (eg qcow2).
Related to bp ssl-connect-rework.
Change-Id: I0568b6c95c5fc7b8eafdbd0284e24c453660a55a
It may not be possible to know in advance the total
size of image data which is to be uploaded, for example
if the data is being piped to stdin.
To handle this we use HTTP Transfer-Encoding: chunked
and do not set any image size headers.
Various subtly different cases needed to be handled for
both image-create and image-update, including:
* input from named pipe
* piped input of zero size
* regular file of zero length
Fix for bug 1056220.
Change-Id: I0c7f0a64d883e058993b954a1c465c5b057f2bcf
When the server refuses the connection the error message displayed now
lists the endpoint that refused the connection.
Fixes: bug 1043067
Change-Id: I62797106732bbb6eec8c99e491fd38850ad58ff8
While uploading a Volume to an image, the HTTPConnection's request method does
not set the Content-Length header (since the volume file is a sym link i.e. the
os.fstat call returns a st_size of 0). This causes Volume uploads to Glance
fail (since the image data is ignored as no content-length is specified).
Therefore setting the Content-Length from update( ) method if the image data is
provided.
Fixes LP: #1045824
Change-Id: If259fc5a338e3e90214a52b773132ed901691c0f
The tests were present but were not asserting list results.
page_size was overriding the absolute limit so limits were
not working if they were less than the page_size.
Fixes bug 1037233
Change-Id: If102824212e3846bc65d3f7928cf7aa2e48aaa63
The legacy client allowed users to pass 'deleted' through an
update call. This is breaking some clients of this library because
they expect to be be able to still do that.
Fixes bug 1036315
Change-Id: I9ae20a5e4579240c7d5e86316d6d1e927755dbf5
To keep a consistent view of an image, is_public, protected, and
deleted need to be cast to a bool when being parsed from headers.
Fix bug 1036299
Change-Id: I2730a0f2d705d26ebc0ba883e99c1caf44d70b51
Cast size, min_ram, min_disk to integers before returning them
to the user from the v1 API.
Fixes bug 1036297
Change-Id: Ib1e2a3bf931e433b6311cc8a1a5219168b50be97
Added the CLI option image-download to download an image via API V2.
Added utility function to save an image.
Added common iterator to validate the checksum.
Related to bp glance-client-v2
Change-Id: I0247f5a3462142dc5e9f3dc16cbe00c8e3d42f42
* Refactor helper function that builds the map of http status codes
to local http exceptions - now we don't have to explicitly list
every single exception name
* Add several exceptions to represent http status codes that were not
previously represented
* Improve consistency of exceptions naming by prepending 'HTTP' to
necessary exception names
* Use HTTPException instead of ClientException
* Deprecate old http exceptions (those that aren't prefixed with HTTP)
* Deprecate ClientException
* Deprecate unused NoTokenLookupException and EndpointNotFound
* Add test module to spot-check the from_response helper
Change-Id: Ibc7fef9e2a5b24bd001d183d377901f302d650a9
The v2 API no longer returns images in JSON containers like
'{"image": {...}}', so stop trying to decode the responses
as if it does.
Fix bug 1031185
Change-Id: I5209fe76445d4195b12944146a0ef190883f363f
* 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
* 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
* 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
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
* 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
* Add image-create command
* Add tests for Image model, Controller.get, and Controller.list
* Related to bp glance-client-v2
Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a06
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
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
* 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
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
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
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
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