summaryrefslogtreecommitdiff
path: root/glanceclient/v1/shell.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | Show a pretty progressbar when uploading and downloading an image.mouad benchchaoui2013-08-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Allow v1 client to list all users' imagesStuart McLaren2013-07-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | 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
* | Add v1 client side owner based filteringStuart McLaren2013-07-261-0/+8
|/ | | | | | | | | | | | | 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
* Merge "Fix problem where image data is not read from a pipe."Jenkins2013-06-181-3/+4
|\
| * Fix problem where image data is not read from a pipe.Hugh Saunders2013-06-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Replace utils.ensure_(str|unicode) with strutils.safe(decode|encode)Flaper Fesp2013-06-041-1/+2
|/ | | | | | | | | | | | | | | | 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
* Don't attempt to read stdin if it is empty.Hugh Saunders2013-05-231-2/+2
| | | | | | | | | | | | * 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
* Merge "Improve Python 3.x compatibility"Jenkins2013-04-241-1/+1
|\
| * Improve Python 3.x compatibilityDirk Mueller2013-04-221-1/+1
| | | | | | | | | | | | | | | | Some mechanical translation of the deprecated except x,y construct. Should work with Python >= 2.6 just fine Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
* | bug 1166263 image-update handling for closed stdinMattieuPuel2013-04-161-9/+16
|/ | | | | | | | 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
* Filter images list by public=True|FalseJohn Bresnahan2013-03-301-1/+4
| | | | | | | | | 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
* Merge "Decode input and encode output"Jenkins2013-02-181-1/+2
|\
| * Decode input and encode outputFlaper Fesp2013-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix typo in image-update help pageDavid Wittman2013-01-301-4/+4
|/ | | | | | | | | The image-update help page reversed the DISK_FORMAT and CONTAINER_FORMAT metavars. Fixes bug #1111054 Change-Id: Iec8374782d00e8e9102141fb1e1c16d7f6ac136c
* Add image names to glance command arguments.Ken'ichi Ohmichi2013-01-051-17/+23
| | | | | | | | | | | | | | | | | | | | 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
* Update --location help to reference swift store.Brian Waldon2012-12-031-8/+6
| | | | | | Fixes bug 1085575. Change-Id: I6b325874a21e63fa02fe261f19e3d071f2b220d9
* Merge "Change default image sort to use name"Jenkins2012-11-301-1/+1
|\
| * Change default image sort to use nameBrian Waldon2012-11-281-1/+1
| | | | | | | | | | | | Fixes bug 1081542. Change-Id: I9e09c3fe3b6c2bfce7e37df1d29b37a42168e878
* | Merge "Add --sort-key and --sort-dir to image-list"Jenkins2012-11-301-2/+12
|\ \ | |/
| * Add --sort-key and --sort-dir to image-listBrian Waldon2012-11-281-2/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Allow setting x-image-meta-store through shell on image creation"Jenkins2012-11-261-0/+2
|\ \ | |/ |/|
| * Allow setting x-image-meta-store through shell on image creationFlorian Haas2012-11-241-0/+2
| | | | | | | | | | | | | | 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
* | Pin pep8 to 1.3.3Chuck Short2012-11-251-2/+2
|/ | | | | | | | 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>
* Merge "Make image sizes more readable for humans"Jenkins2012-11-191-4/+22
|\
| * Make image sizes more readable for humansChristian Berendt2012-11-191-4/+22
| | | | | | | | | | | | | | | | | | 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
* | Set useful boolean flag metavarsBrian Waldon2012-11-191-4/+4
| | | | | | | | | | | | | | | | | | 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
* | Enhance --checksum help with algorithmAndre Naehring2012-11-141-1/+2
|/ | | | | | | | | 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
* Merge "Allow deletion of multiple images through CLI"Jenkins2012-10-251-3/+18
|\
| * Allow deletion of multiple images through CLISulochan Acharya2012-10-241-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fixes shell command for member-deleteSulochan Acharya2012-10-231-5/+5
|/ | | | | | | | Fixes the member-delete cli command and string formatting for dry-run option. Fixes bug1064320 Change-Id: I338f03d53da5c9b7656ae4d1335de9623b774dd8
* Merge "Display acceptable disk/container formats in help text"Jenkins2012-10-131-6/+12
|\
| * Display acceptable disk/container formats in help textBrian Waldon2012-10-041-6/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* | Handle create/update of images with unknown sizeStuart McLaren2012-10-081-3/+14
|/ | | | | | | | | | | | | | | | | | | | 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
* Merge "Fixes glance add / update / image-create / image-update on Windows"Jenkins2012-09-181-10/+18
|\
| * Fixes glance add / update / image-create / image-update on WindowsAlessandro Pilotti2012-09-131-10/+18
| | | | | | | | | | | | | | | | | | | | 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
* | Typo in image-create help pageStuart McLaren2012-09-171-2/+2
|/ | | | | | | | | The image-create help page reversed the DISK_FORMAT and CONTAINER_FORMAT metavars. Fixes bug 1051968. Change-Id: I385cb0912ad87a62fd10742b5da23a5ea8bc9bb8
* Merge "Update command descriptions"Jenkins2012-08-211-1/+6
|\
| * Update command descriptionsBrian Waldon2012-08-211-1/+6
| | | | | | | | | | | | | | | | 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
* | Enable client V1 to download imagesLars Gellrich2012-08-161-0/+11
|/ | | | | | | | | Added the CLI option image-download to download an image via API V1. Based on commit 137b3cf975d73437943e100065c76b83acfa7dd3 Related to bp glance-client-v2 Change-Id: Ie587e208ad7433e468798cd9b1846b4a21e1c4ec
* Add legacy compat layer to v1 shellBrian Waldon2012-08-011-1/+9
| | | | | | | | | | | | | | | 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
* Add pagination to v1 image-listBrian Waldon2012-07-191-1/+6
| | | | | | | | | | | | | | | | * 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
* Add --is-public to image-createBrian Waldon2012-07-131-1/+6
| | | | | | | | | | | 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
* Translate is_protected to protectedBrian Waldon2012-07-111-0/+6
| | | | | | | | | When creating or updating an image, translate the 'is_protected' argument into the proper 'protected' image attribute. Fix bug 1023653 Change-Id: Icfe6c38e4fda098ce3f90fd94c8fbbc18be2f4a8
* Change --protected to --is-protected in createBrian Waldon2012-07-111-1/+1
| | | | | | | | | Make image-create match image-update when specifying a specific value for 'protected'. Fix bug 1023650 Change-Id: I02ddeb59c1f6882b206279a71f7af8889ce4602c
* Properly map boolean-like arguments to True/FalseBrian Waldon2012-07-111-2/+2
| | | | | | | | --is-public and --is-protected are now evaluated as True and False Fix bug 1023652 Change-Id: Ife2313770eebc176e7744711956aed20f16576a5
* Preserve image properties on updateBrian Waldon2012-07-091-1/+5
| | | | | | | | | | * 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 --file to image-update and correct bad nameBrian Waldon2012-07-091-3/+7
| | | | | | | | | * 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
* Allow image filtering by custom propertiesBrian Waldon2012-07-041-0/+8
| | | | | | | | | | | 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
* Expand v1 image-list filtersBrian Waldon2012-07-041-5/+12
| | | | | | | | | 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 filtering to image-list actionBrian Waldon2012-07-041-1/+10
| | | | | | | | | | 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