Glanceclient implemented both functions before they landed into oslo.
Since both functions are already in oslo, it is now possible to pull
them in.
There's a small difference between glance's implementation and oslo's,
that is the later does not convert non-str objects - int, bool - to str
before trying to decode / encode them. This patch takes care of that
where necessary, more precisely, while encoding headers before doing a
new request.
Fixes bug: #1172253
Change-Id: I9a0dca31140bae28d8ec6aede515c5bb852b701b
For image-updae and image-create commands, glanceclient attempts to
determine whether image data should be uploaded based on the presence
of data on stdin. Unforunately it is difficult to determine if data is
available, especially when standard in is from a pipe.
This is especially problematic for update operations, where data must
only be uploaded if the image is in queued state. For example data may
be uploaded when the user only wants to rename an image, but the rename
will be rejected because data cannot be uploaded to an unqueued image.
This patch removes the check that attempts to determine if data is
available to read as it didn't work for pipes. It also re-introduces a
check for image state in the update operation, so that glanceclient only
attempts to read data if the image being updated is in queued state.
The image state check is part of the original patchset that was removed
so the patchset could have a single focus [1]
This patch also removes a test for handling empty stdin, and adds a test
for reading stdin from a pipe.
[1] https://review.openstack.org/#/c/27536/3/glanceclient/v1/shell.py
Fixes: bug 1184566
Related to: bug 1173044
Change-Id: I8d37f6412a0bf9ca21cbd75cde6a4d5a174e5545
* Check for available data size in v1/shell.py/_set_data_field, don't
read if 0.
* Add test_shell.py including tests for 3x stdin scenarios:
* closed
* open and empty
* open with data
Change-Id: I6ff65b0e226be509de9cd3f021560081529283b0
Fixes: bug #1173044
Some mechanical translation of the deprecated
except x,y construct. Should work with Python >= 2.6
just fine
Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
handles the case where an image-update command is issued from a cron job with an
invalid standard input file descriptor: consider no image data is provided when
no --file option present.
Change-Id: I5eb3433311e5faf0a3fb7eb36f6a01e5df7efe4c
When running the image-list command the user should have the option
to list images according to whether or not the image is was set
to public. A new test is included to verify this behavior.
Change-Id: If645e7390fcf850648cda780a04ea37a26d855a2
Fixes bug: 1118799
Currently glanceclient doesn't support non-ASCII characters for images
names and properties (names and values as well). This patch introduces 2
functions (utils.py) that will help encoding and decoding strings in a
more "secure" way.
About the ensure_(str|unicode) functions:
They both try to use first the encoding used in stdin (or python's
default encoding if that's None) and fallback to utf-8 if those
encodings fail to decode a given text.
About the changes in glanceclient:
The major change is that all inputs will be decoded and will kept as
such inside the client's functions and will then be encoded before
being printed / sent out the client.
There are other small changes, all related to encoding to str,
around in order to avoid fails during some conversions. i.e: quoting
url encoded parameters.
Fixes bug: 1061150
Change-Id: I5c3ea93a716edfe284d19f6291d4e36028f91eb2
The image-update help page reversed the DISK_FORMAT
and CONTAINER_FORMAT metavars.
Fixes bug #1111054
Change-Id: Iec8374782d00e8e9102141fb1e1c16d7f6ac136c
Now a user should specify ID as an image by glance command, and I feel
it is easy-use that a user can specify name also as an image like nova
command(ex. "nova boot").
By applying this patch, a user can specify name as image like the
following examples:
$ glance image-show cirros-0.3.0-x86_64-uec
$ glance image-update --name root-fs cirros-0.3.0-x86_64-uec
$ glance image-delete cirros-0.3.0-x86_64-uec
$ glance image-download cirros-0.3.0-x86_64-uec
$ glance member-create cirros-0.3.0-x86_64-uec 94b0e63a27ca43348fe056622fe3fe94
$ glance member-delete cirros-0.3.0-x86_64-uec 94b0e63a27ca43348fe056622fe3fe94
Fixes bug 1093380
Change-Id: Ia0a070eed6ae3853ef02032f479087edb1d75a67
The --sort-key and --sort-dir CLI options allow users to control the
field and direction by which their images are sorted in an image-list
operation. The previous default sort behavior of sorting by ID asc has
been preserved.
Fixes bug 1082957.
Change-Id: I1d3664219c275b0379fe176f8288d6ffae0dffbe
Standardize pep8 to 1.3.3 and cleared up any errors
found by pep8 tests.
Change-Id: Ib7eb97d0789556d1676ccad58b5d3364065b7d15
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Add a command line arg "--store" to "glance image-create" so users
can specify a store other than the default on image creation.
Change-Id: Icf9a894b08e405d6884964b3cfaa80250e85ed71
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
The boolean flags --is-protected and --is-public now
communicate that they must be set to True or False.
Fixes bug 1056501.
Change-Id: I23094ea556eb71d6eb977a64c171119738ed792b
Fixes bug 1056499.
Added a line to the help text of --checksum which enhances the help text
to show what checksum algorithm is expected.
Change-Id: Ie6604022dd9f398c639afe647b2d94b5179dbb61
Add nargs to argparse for image-delete command to
allow muliple (optional) positional image-id arguments.
For example:
image-delete xxx aaa yyy will delete valid images
xxx and yyy and print error message for invalid image
aaa. Also with --verbose you can see some extra text
on delete request for each image.
Fixes bug1056498.
Change-Id: I6e804700ed24d16f90ec92569c0893cad4aaa26f
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
Fixes bug #1056497
This patch provides more information in the help text. Originally the text
provided the trivial definitions of the arguments disk_format and
container_format. This patch updates the text to display the acceptable
formats.
Change-Id: I893b52c9f72a34c75e8bea522820863592300302
The image-create help page reversed the DISK_FORMAT
and CONTAINER_FORMAT metavars.
Fixes bug 1051968.
Change-Id: I385cb0912ad87a62fd10742b5da23a5ea8bc9bb8
Fixes Bug #1050345
The image upload hangs if the file contains a byte with value 0x1A (EOF), due to
the fact that the file or stdin streams are treated as text and not
binary streams. This fix sets the proper binary mode.
Change-Id: I3425cb9729a8da4d1b73fbfba06fd6f2c7e8833e
Several commands did not have descriptions or the descriptions
they had were insufficient. This adds mission descriptions
and fattens up those that were too lean.
Change-Id: I091ae70cdae5d3f72f273519d88873cb5392ba3b
Added the CLI option image-download to download an image via API V1.
Based on commit 137b3cf975
Related to bp glance-client-v2
Change-Id: Ie587e208ad7433e468798cd9b1846b4a21e1c4ec
All legacy CLI commands should work as expected with a few
minor exceptions:
- no upload animation
- no interactive pagination
- help/usage output has changed
Deprecated options are indicated as such in their usage info. Deprecated
commands have descriptions that label them as such.
Related to bp glance-client-parity
Change-Id: I584b2447361967228bea332e14880e18db12fca8
* 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
This moves image-create closer to image-update by adding
--is-public and hiding the help output of --public. The
--public option will be removed once devstack no longer
depends on it.
Fix bug 1023632
Change-Id: I2c58655ba56eef1fa486246618c4fb5bd3c6c8cf
When creating or updating an image, translate the 'is_protected'
argument into the proper 'protected' image attribute.
Fix bug 1023653
Change-Id: Icfe6c38e4fda098ce3f90fd94c8fbbc18be2f4a8
Make image-create match image-update when specifying a specific
value for 'protected'.
Fix bug 1023650
Change-Id: I02ddeb59c1f6882b206279a71f7af8889ce4602c
* 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
* Add the --file option to the image-update action, as it was left out
of a previous patch
* Additionally, change a bad reference (args.fields) to args.file
* Fix bug 1022750
Change-Id: Idde127ec3f138f718d671b2133d50debec26236e
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
Add comparison filters for the v1 image-list command: --name,
--status, --container-format, --disk-format.
Related to bp glance-client-parity.
Change-Id: I27377764ea5543a4bef593f0a731b09a914a9265
Add --size-min and --size-max options to image-list to
represent the size_min and size_max filters passed to
the ImageManager.list method.
Related to bp glance-client-parity
Change-Id: Icb5458c3ed26ea754cff6360b741b3af99d1beb5
Allow an image to be read from a local file as an alternative to
stdin (which remains the default).
Change-Id: I81070ded9c505df7924c4efd5ae54cf3c0fa534d
Fields were missing from image-list that were present in the old index:
'Disk Format', 'Container Format', 'Size'
Change-Id: Ia86caec1938560c56292c0f3028ee48e774d0057