Commit Graph

83 Commits

Author SHA1 Message Date
Louis Taylor b818826420 Remove openstack.common.strutils
This module now lives in oslo.utils, so import it from there instead.

Co-Authored-By: Ian Cordasco <ian.cordasco@rackspace.com>
Change-Id: Ib35dc840992433542490670781badd9529ec8947
2015-01-27 19:22:42 +00:00
Cindy Pallares 6eaaad532a Make non-boolean check strict
Currently when we enter any non-boolean strings in the client, it
accepts it and defaults the value to false. It should check if the
strings are boolean values and respond with an error if they're not.

Closes-Bug: #1394236
Change-Id: Ie498ee1b93524d91a43343f73140446c2cc9ab92
2015-01-06 11:36:01 -05:00
Stuart McLaren 597da8aa55 '--public' ignored on image create
Currently, if '--public' is specified, an image is created but
it is not marked as public:

$ glance image-create --public --name minus-minus-public --disk-format raw \
 --container-format bare < /etc/fstab
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
.
.
.
| is_public        | False                                |
.
.
.
+------------------+--------------------------------------+

This is inconsistent.

'--public' has been deprecated for some time, and has
been removed from devstack (https://review.openstack.org/#/c/39323/),
so we can finally get rid of it.

We now raise the standard error for unsupported arguments.

Change-Id: I15d16f690f9bd92b4cefbc8ed36ed2d171ff22f3
Closes-bug: #1378844
2014-10-08 13:58:22 +00:00
Cindy Pallares 1dfce5301c Remove deprecated commands from shell
Remove all deprecated commands from the shell
since they are no longer used and to keep
the command line menu from looking cluttered.

Closes-bug: #1314218

Change-Id: I66e82872988e3835e4f290f48dfc80538271426c
2014-08-12 05:30:59 -05:00
Stuart McLaren f75a81000e Use a correctly formatted example location in help
Change-Id: Iea1ebc13979a61d7bed397fb79e2b2a85f00c400
Closes-bug: 1342753
2014-07-16 15:05:37 +00:00
Cindy Pallares 04fb3c2624 Convert passed integer values into int in v1 shell
Add the type to the parameters that require an integer
in the V1 shell to avoid sending an improper request.

Change-Id: Idb1ed39b11ca737fdd42d24e297c142f28dce35c
2014-06-12 15:59:49 +00:00
Juan Manuel Olle 083986ad7e Fix help text in image-create
Image-create help text makes reference of a non existing
parameter --copy_from

Change-Id: I26d584c350734bb26a6cf965a2198f0782dd0a9f
2014-06-03 17:15:01 -03:00
Jenkins 59c1103655 Merge "Improve help strings" 2014-03-16 17:16:54 +00:00
Andreas Jaeger 2c53246184 Improve help strings
Make help strings consistent to use "." at end of string.

Fix capitalization of API in one help string.

Change-Id: I7cc5289d881c5e58aad9c69b4668584cdeb0b376
2014-02-26 13:57:58 +01:00
Jon Bernard 0934b97897 Only show progress bar for local image files
This patch fixes a bug where both 'location' and 'progress' are passed
as command line arguments.  In this case, the 'data' field is not
present in the fields dict and therefore the progress option cannot be
used.  A check is added to make sure the user has specified both a local
image file and the progress flag together.

Change-Id: Ia563139ee8b56d54d480534986e4b619a503fbfc
Closes-Bug: #1259357
2014-01-31 13:54:44 -05:00
llg8212 e5f6dee95d Using common method 'bool_from_string' from oslo strutils
Using common method 'bool_from_string' from oslo strutils to replace
utils.string_to_bool.

partially implements blueprint common-client-library-2

Change-Id: I23924db3000feadcfe823c6cc979ea9752a13fa9
2014-01-24 10:07:44 +08:00
Yassine Lamgarchal 627e66b9d8 Python 3: use six.iteritems() instead of iteritems()
Six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.

Change-Id: I12fda5f20d2f4fe8227e45b2fe46b332f63deb97
2014-01-09 13:41:46 +01:00
Fei Long Wang 336feeb523 Get better format for long lines with PrettyTable
Based on current implement, the cli output format will be bad if
the lines are too long. This issue can be fixed by setting 'max_width'.
However, there is a bug against it, see
https://code.google.com/p/prettytable/source/browse/trunk/CHANGELOG?r=85
line 3. So the requirements.txt is updated as well.

docImpact
Fixes bug 1251283

Change-Id: I0d4192ad9d10a3d6d47a8319463a5edb57719a68
2014-01-06 20:48:54 +08:00
Dirk Mueller 9f255a9b49 Fix and enable gating on H306
H306 - module imports should be in alphabetical order

Change-Id: I1f8fc25b0e6ca23c21c90bda420f42a45141c2e2
2013-12-16 15:28:05 +01:00
Jenkins 9a649d46ea Merge "Replace OpenStack LLC with OpenStack Foundation" 2013-11-15 06:33:28 +00:00
Jenkins 12a1d719b2 Merge "Fix python 3.x related Hacking warnings" 2013-11-12 04:38:33 +00:00
eddie-sheffield 32d9c42816 Add CLI for V2 image create, update, and upload
Provides command line support for image-create, image-update,
and image-upload using the Glance V2 API. This includes building
help text for create and update based on the image jsonschema
as fetched from the server.

Also fixes bug caused by default warlock patch generation not
matching what Glance expects when updating a core property
which had not originally been set when the image was created.

Related to bp glance-client-v2

Change-Id: I841f9e3d05802f4b794cb6f4849abe03ff0324d9
2013-10-02 13:22:55 -04:00
ZhiQiang Fan 2517203975 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I38dcbcf1a6c8efe540fcf5f29e782cb3826e583d
Fixes-Bug: #1214176
2013-09-20 04:05:51 +08:00
Dirk Mueller 69fa91b432 Fix python 3.x related Hacking warnings
Convert print operator usages to print functions.
Fix one instance of outdated "except x,y:" syntactical construct.
Remove usages of local() in string formatting alongway.

Change-Id: Id0673a9183a6ea6bd9bf3f5c6d8e7c5f114ebf01
2013-08-26 14:25:23 +02:00
Gabe Westmaas b6e117f151 Fix glanceclient usage inconsistences for options
Enumerated options should have the same format for all enumerated options.

This commit moves all options to the {option1,option2} format.

fixes bug: #1155171

Change-Id: I8e0ecf3896c76021cb027cbbbb3b5564a04aacec
2013-08-25 01:14:07 +00:00
Dean Troyer 53d3a0e129 Revert "removed deprecated parameter --public"
While trunk devstack was updated for this, stable/folsom and stable/grizzly
are not and grenade is now broken.  I'm not sure how long --public was
undocumented but it may be that certain cli args may need to remain deprecated
but supported for longer than we wish.

This reverts commit ce8636b6b3

Change-Id: I91d4884e470c8fcc611dae62a30fa22d08dbec03
2013-08-19 14:46:28 -05:00
Jenkins 20bd548d71 Merge "removed deprecated parameter --public" 2013-08-19 15:34:56 +00:00
mouad benchchaoui 1d7da740b2 Show a pretty progressbar when uploading and downloading an image.
Add a new module that contain generic wrapper for file and iterator, which
are used to wrap image to upload and the request body iterator in upload and
download cases repectively, to show and advance a pretty progress bar when this
laters are consumed, The progress bar is triggered by adding a --progress command
line argument to commands: image-create, image-download or image-update.

Change-Id: I2ba42fd0c58f4fa087adb568ec3f08246cae3759
bug fix: LP#1112309
blueprint: progressbar-when-uploading
2013-08-08 15:40:15 +02:00
Christian Berendt ce8636b6b3 removed deprecated parameter --public
As noted by bcwaldon the parameter can be removed after updating
Devstack. Should be done after merging the following change:

https://review.openstack.org/#/c/39323/

Change-Id: I8d0f7ab4cccccf022446374a31e03ac913cfb136
2013-07-30 19:12:59 +02:00
Stuart McLaren bb47812765 Allow v1 client to list all users' images
Add a '--all-tenants' option to the image-list command.  This adds
'is_public=None' to the query string passed to the server, and for an
admin user results in a listing of all images present on the server
irrespective of owner or public values.

Addresses bug 1201787.

Change-Id: I38dd0752a31ebea84f16b786d205e82eba1a96bc
2013-07-26 11:01:52 +00:00
Stuart McLaren 12feedb2cf Add v1 client side owner based filtering
Add the --owner option to the v1 client's image-list command to support
filtering images based on the owner (tenant id).

Allows administrators to more easily list a particular user's images.

Note that this is far less efficient than v2 server-side owner based filtering.

Addresses bug 1201765.

Change-Id: I4ffa522b96c91e659c87f5452f2f1f44e47e806b
2013-07-26 11:00:32 +00:00
Jenkins c120aff87f Merge "Fix problem where image data is not read from a pipe." 2013-06-18 12:47:31 +00:00
Flaper Fesp 7818387d4a Replace utils.ensure_(str|unicode) with strutils.safe(decode|encode)
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
2013-06-04 00:42:32 +02:00
Hugh Saunders 9fda0dc815 Fix problem where image data is not read from a pipe.
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
2013-06-03 18:01:58 +01:00
Hugh Saunders a3585ef62d Don't attempt to read stdin if it is empty.
* 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
2013-05-23 13:37:09 +01:00
Jenkins 4bbc7b8a9b Merge "Improve Python 3.x compatibility" 2013-04-24 16:38:25 +00:00
Dirk Mueller 45feb672af Improve Python 3.x compatibility
Some mechanical translation of the deprecated
except x,y construct. Should work with Python >= 2.6
just fine

Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
2013-04-22 16:38:55 +02:00
MattieuPuel 5ab88370d0 bug 1166263 image-update handling for closed stdin
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
2013-04-16 14:34:58 +02:00
John Bresnahan a8f7de2afd Filter images list by public=True|False
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
2013-03-30 21:26:35 -10:00
Jenkins d831b5eb27 Merge "Decode input and encode output" 2013-02-18 18:58:14 +00:00
Flaper Fesp 55cb4f4473 Decode input and encode output
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
2013-02-13 21:53:11 +01:00
David Wittman ed67c32014 Fix typo in image-update help page
The image-update help page reversed the DISK_FORMAT
and CONTAINER_FORMAT metavars.

Fixes bug #1111054

Change-Id: Iec8374782d00e8e9102141fb1e1c16d7f6ac136c
2013-01-30 22:15:19 -06:00
Ken'ichi Ohmichi 0aba81ac1f Add image names to glance command arguments.
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
2013-01-05 07:32:25 +09:00
Brian Waldon 2500e69b22 Update --location help to reference swift store.
Fixes bug 1085575.

Change-Id: I6b325874a21e63fa02fe261f19e3d071f2b220d9
2012-12-03 15:01:34 -08:00
Jenkins 7be3395c6c Merge "Change default image sort to use name" 2012-11-30 21:27:15 +00:00
Jenkins b66e6faac0 Merge "Add --sort-key and --sort-dir to image-list" 2012-11-30 21:22:23 +00:00
Brian Waldon 4fa6805242 Change default image sort to use name
Fixes bug 1081542.

Change-Id: I9e09c3fe3b6c2bfce7e37df1d29b37a42168e878
2012-11-28 09:50:46 -08:00
Brian Waldon 4da8b287b4 Add --sort-key and --sort-dir to image-list
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
2012-11-28 09:46:32 -08:00
Jenkins 09c8216177 Merge "Allow setting x-image-meta-store through shell on image creation" 2012-11-26 23:20:19 +00:00
Chuck Short c0ec97f310 Pin pep8 to 1.3.3
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>
2012-11-25 11:34:56 -05:00
Florian Haas c2ba627ec1 Allow setting x-image-meta-store through shell on image creation
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
2012-11-24 11:22:41 +01:00
Jenkins e40580b77a Merge "Make image sizes more readable for humans" 2012-11-19 18:56:52 +00:00
Christian Berendt b24832c22a Make image sizes more readable for humans
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
2012-11-19 10:15:19 -08:00
Brian Waldon 0e90f8ef23 Set useful boolean flag metavars
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
2012-11-19 09:08:50 -08:00
Andre Naehring 00eff28f28 Enhance --checksum help with algorithm
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
2012-11-14 15:37:31 +01:00