summaryrefslogtreecommitdiff
path: root/glanceclient/v2/shell.py
Commit message (Collapse)AuthorAgeFilesLines
* do_image_import: fix argument retrievalCyril Roelandt2023-04-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The argparse module automatically replaces '-' characters with '_' characters when converting an option string to an attribute: «For optional argument actions, the value of dest is normally inferred from the option strings. ArgumentParser generates the value of dest by taking the first long option string and stripping away the initial -- string. If no long option strings were supplied, dest will be derived from the first short option string by stripping the initial - character. Any internal - characters will be converted to _ characters to make sure the string is a valid attribute name.»[1] This means that the value of the "--remote-region" option of the "image-import" command will be available as "args.remote_region"; "remote-region" would not be a valid attribute anyway. We make sure to retrieve the proper value for the following options: --remote-region, --remote-image-id and --remote-service-interface. [1] https://docs.python.org/3/library/argparse.html#dest Change-Id: I1d8c69acd5d61fdc426469cd87d1ace81871e60f Partial-Bug: #2012442
* schema_args: Do not generate option for read-only propertiesCyril Roelandt2022-09-261-18/+5
| | | | | | | | | | The schema_args decorator generates command line options based on the properties defined in a schema. This commit makes sure read-only properties are skipped during this process, since trying to modify their value would result in a Glance error. Closes-Bug: #1561828 Change-Id: I7ccc628a23c9ebdaeedcb9e6d43559f497ce9555
* Add support for glance-download import methodPranali Deore2022-08-301-4/+56
| | | | | Implements: blueprint glance-download-import-support Change-Id: Ia2bfad82bccf9acb6103b21112e680c44e295d39
* Check if stdin has isatty attributeBenedikt Loeffler2022-07-071-2/+2
| | | | | | | When the stdin is closed, it has no isatty atrribute which leads to a KeyError. Closes-Bug: #1980890 Change-Id: If9a3bf68b8dfd953b346697241166578d18bb563
* Add support for Cache APIErno Kuvaja2022-02-221-0/+71
| | | | | | | This change provides support for the Cache API changes and deprecation path for glance-cache-manage command. Change-Id: I6fca9bbe6bc0bd9b14d8dba685405838131160af
* Merge "Add an optional parameter --append"Zuul2022-02-171-2/+4
|\
| * Add an optional parameter --appendMridula Joshi2022-02-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | This patch will add an optional parameter --append to the glanceclient command md-tag-create-multiple to provide the facility of appending the tags. If the parameter is present it will append the tags to existing one, else it will overwrite the existing tags. Depends-On: https://review.opendev.org/c/openstack/glance/+/804966 Change-Id: I1841e7146da76b13f4cd8925e19f59d0eaf08f7a
* | Merge "Add an optional parameter --detail"Zuul2022-02-161-2/+6
|\ \
| * | Add an optional parameter --detailMridula Joshi2022-02-021-2/+6
| |/ | | | | | | | | | | | | | | | | This patch appends th --detail parameter to the ``stores-info`` command. With sufficient permissions, display additional information about the stores. Depends-On: https://review.opendev.org/c/openstack/glance/+/824438 Change-Id: I6ae08ab3eaab0c2b118aa7607246214b28025dfe
* | Add support for usage APIDan Smith2022-01-311-0/+9
|/ | | | | | | | This is really a very simple activity of fetching and showing the results of the usage API in table form for the user. Depends-On: https://review.opendev.org/c/openstack/glance/+/794860 Change-Id: I3d9360785a759e4a6e7905710400baea80776052
* Add member-get commandMridula Joshi2021-08-021-1/+9
| | | | | | | | | It is observed that python-glanceclient was missing support for GET /v2/image/{image_id}/member/{member_id} API. This patch adds new command `member-get` to support this missing operation. Closes-Bug: #1938154 Change-Id: I3709f6a39535aa45bee70f468f015ac60a1375a8
* Get tasks associated with imageAbhishek Kekane2021-03-021-0/+18
| | | | | | | Add support to get tasks associated with specific image. bp: messages-api Change-Id: Ia505cf6f47ca6c628e195be3ca5231d22d53040d
* Fixes "stores" property added to the image3.2.1Erno Kuvaja2020-07-301-0/+3
| | | | | | | | "stores" property gets added to the image when `glance image-create-via-import` is called with --stores Change-Id: I514e6e3ac2f3a1f56fb7883ed403a04b1e7f13b0 Closes-Bug: #1889666
* Update hacking for Python3Andreas Jaeger2020-04-021-9/+9
| | | | | | | | | | | | The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Remove hacking and friends from lower-constraints, they are not needed for installation. Change-Id: I5ae47a7b11ff29a301e440c15daf30db7738485b
* Delete image from specific storeErno Kuvaja2020-03-201-0/+18
| | | | | | | Add support to delete image from specific store. bp: delete-from-store Change-Id: Ie57d7de5822264a5ea8a5f4587ab8cfb4afb79de
* Add support for copy-image import method3.0.0Abhishek Kekane2020-02-271-0/+12
| | | | | | | | This change adds support for copy-image import method which will copy existing images into multiple stores. Change-Id: I748a8fb3dbaf9c2e4d887a2ecd4325e27a8429c4 bp: copy-image-multiple-stores
* Add support for multi-store importErno Kuvaja2020-02-271-7/+95
| | | | | | | | | | | This change adds support for providing multiple target stores where image can be imported. Co-authored-by: Erno Kuvaja <jokke@usr.fi> Co-authored-by: Abhishek Kekane <akekane@redhat.com> bp: import-multi-stores Change-Id: I8730364263f1afd5d11fd56939851bda73a892bb
* Merge "Rename --backend to --store"2.17.0Zuul2019-09-131-21/+21
|\
| * Rename --backend to --storeAbhishek Kekane2019-05-141-21/+21
| | | | | | | | | | | | | | | | As a part of vocabulary correction renamed --backend parameter to --store. Modfied corresponding tests as well. bp:multi-store-vocabulary-correction Change-Id: I3dc115f5f0f3c4edcca0209e139aa3d1d816357c
* | Correcting typo in shell.py - enviroment to environment.root2019-07-301-1/+1
|/ | | | | | | There is a typographical error in glanceclient/v2/shell.py. Correcting spelling from enviroment to environment. Change-Id: Ia19a4417cd05d228adc26f9d7c82f4aa3c24488c
* Merge "Embed validation data when adding location"Zuul2019-03-071-1/+15
|\
| * Embed validation data when adding locationimacdonn2018-10-241-1/+15
| | | | | | | | | | | | | | | | Add support for embedding of checksum, os_hash_algo and os_hash_value when adding a location to an image. Depends-On: https://review.openstack.org/597648 Change-Id: Ibbe2f2bb226f52cc6b2ab591913b1797d2b086c0
* | Add image-list filter for multihashBrian Rosmaita2019-01-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | This was missed when multihash support was added to the glanceclient. The os_hash_value is an indexed field in the API. Includes a release note. Closes-bug: #1788271 Change-Id: Ibfe28b8c644967b7e0295dfd3f55c3ae1b0cbb2d
* | Show the backend store infoLiang Fang2018-11-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running "glance -v image-list" there's no store info listed, so user cannot know the type of the backend. This patch added an new option "--include-stores" and is to add the store id to the output of "glance image-list --include-stores". The final output may like: +-----+------+-------------+-----+----------+--------+-----+------+ | ID | Name | Disk_format | ... | Size | Status |Owner|Stores| +-----+------+-------------+-----+----------+--------+-----+------+ | xxx | img1 | raw | ... | 10737418 | active | xxx | ceph | | xxx | img2 | raw | ... | 5086345 | active | xxx | file | +-----+------+-------------+-----+----------+--------+-----+------+ Change-Id: If86ef714c3aa03ce43ef29f26892f431f4766560 Co-authored-by: Jack Ding <jack.ding@windriver.com> Signed-off-by: Liang Fang <liang.a.fang@intel.com>
* | Use "multihash" for data download validationBrian Rosmaita2018-09-071-1/+13
|/ | | | | | | | | | | | When the Glance "multihash" is available on an image, the glanceclient should use it instead of MD5 to validate data downloads. For cases in which the multihash specifies an algorithm not available to the client, an option is added to the image-download command that will allow fallback to the legacy MD5 checksum verification. Change-Id: I4ee6e5071eca08d3bbedceda2acc170e7ed21a6b Closes-bug: #1788323
* Add support for hide old imagesAbhishek Kekane2018-07-251-7/+43
| | | | | | | | Added --hidden argument to list, create and update call. Related to blueprint hidden-images Change-Id: I1f2dcaa545c9da883186b20a96a70c7df994b994
* Merge "Add multi-store support"Zuul2018-07-251-3/+82
|\
| * Add multi-store supportAbhishek Kekane2018-07-241-3/+82
| | | | | | | | | | | | | | | | | | | | | | | | Added multi-store support. User can now use '--backend' option to pass desired store while creating, uploading or importing image to speific store backend. Added new command 'stores-info' which will return available stores information to the user. Related to blueprint multi-store Change-Id: I7370094fc4ed47205b5a86a18b22aaa7b9457e5b
* | Merge "Add support for multihash"Zuul2018-07-241-3/+6
|\ \
| * | Add support for multihashAbhishek Kekane2018-07-231-3/+6
| |/ | | | | | | | | | | Related to blueprint multihash Change-Id: Iff4a5fe224b5d47255d7f23f65bbc08468f47f02
* | image-list: add checksum algorithm descriptionChen Hanxiao2018-07-241-1/+1
|/ | | | | | | | We use MD5 for checksum, add this description in cli helps. Change-Id: I3469b0dface63f4684ad39421eee4c2a2de4d80b Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
* Make image-import fail fasterBrian Rosmaita2018-04-041-10/+44
| | | | | | | | Add checks to image-import command so that it provides better user feedback in failure situations. Change-Id: I8b6b32c3d1d1a745aa68ff8dc629419dff9bb130 Closes-bug: #1758718
* Make image-create-via-import fail fasterBrian Rosmaita2018-04-041-20/+70
| | | | | | | | | | | | | | Add checks to the image-create-via-import commmand so that it provides better user feedback and doesn't begin the import workflow unless the input has a chance of succeeding. Preserves backward compatibility with the current image-create command by (1) allowing an image record only to be created when no import-method is specified AND no data is supplied, and (2) doing the glance-direct workflow when no import- method is specified AND data is provided. Also adds the ability for the import-method to be set as an env var OS_IMAGE_IMPORT_METHOD. Change-Id: I0a225f5471a9311217b5d90ebb5fd415c369129a Closes-bug: #1758149
* Check for container,disk_format on web-downloadBrian Rosmaita2018-03-221-1/+1
| | | | | | | | | Fail image-create-via-import requests for the web-download import method that don't include values for container_format or disk_format. Closes-bug: #1757927 Change-Id: Ic5c81916823ff32f2dbddd32b40e825de0697dc9
* Add support for web-download import methodPranaliD2018-03-211-5/+21
| | | | | | | | | | | | | This change adds support for 'web-download' import method to 'image-import' and 'create-image-via-import' call. To use this 'web-download' import method, user needs to pass --uri option 'a valid uri to external image to import in glance' to 'image-import' and 'create-image-via-imaport' calls. Co-authored-by: Pranali Deore <pdeore@redhat.com> Co-authored-by: Erno Kuvaja <jokke@usr.fi> Change-Id: I0e1d18844f64723608288de473e97710798eb602
* Compare against 'RequestIdProxy.wrapped'Stephen Finucane2018-01-021-1/+1
| | | | | | | | | | | | Due to the 'glanceclient.common.utils.add_req_id_to_object' decorator, an instance of 'glanceclient.common.utils.RequestIdProxy' is returned for most calls in glanceclient. If we wish to compare to None, we have to compare the contents of this wrapper and not the wrapper itself. Unit tests are updated to highlight this. Change-Id: I7dadf32d37ac2bda33a92c71d5882e9f23e38a82 Closes-Bug: #1736759
* image-create-via-import fails with ValueErrorAbhishek Kekane2017-08-241-1/+4
| | | | | | | | | | | | | | CLI image-create-via-import fails with ValueError. The reason is create command returns RequestIdWrapper object and not image and response. Further it fails with AttributeError: 'Namespace' object has no attribute 'import_method'. The reason is do_import_image() call requires 'import_method' as input which is not provided at the moment. Change-Id: Ic4c4d1f3c5d290b584840e8f9047fb53611a5748 Closes-bug: #1711511
* Add missing docstring2.8.0Erno Kuvaja2017-07-271-0/+1
| | | | | | Adding missing docstring for image-import command. Change-Id: Ide95056797230963e9ef63c1cb72d42e697023e7
* Merge "Add image import features to client"Jenkins2017-07-271-0/+103
|\
| * Add image import features to clientErno Kuvaja2017-07-271-0/+103
| | | | | | | | | | | | | | | | | | | | | | This change adds availability of the features introduced on Image Import Refactoring work. Including: Discovery call to discover what Import modes are available Staging call to stage the image for import in 'glance-direct' Import call to trigger the actual Image Import task EXPERIMENTAL: Image creation with the new workflow Change-Id: I2d10ac0cc951c933c3594837b490638e38ff0b12
* | Validate input args before trying image downloadRavi Shekhar Jethani2017-07-241-7/+8
|/ | | | | | | | | | | | Currently client is contacting glance service even if the caller has niether specified any redirection nor '--file' option. This unnecessary request although isn't causing any critical issues but can be avoided by simply doing input validation first. TrivialFix Change-Id: I841bebeda38814235079429eca0b1e5fd2f04dae
* Replace dict.iteritems() with dict.items()Luong Anh Tuan2016-12-201-2/+2
| | | | | | | Following Python 3 guide https://wiki.openstack.org/wiki/Python3 Thus, we should replace task.iteritems() with task.items() Change-Id: If617c3a87836930dc78a4ce7dd45a9b7804e0d24
* Fixed grammar in image-download command descriptionIhar Hrachyshka2016-06-011-1/+1
| | | | Change-Id: Ie18e1bee3376fdc01685c6f1d3a949c6934296b3
* Ship the default metadata schema in the clientwangxiyuan2016-03-241-0/+6
| | | | | | | | | | | | | | | | | | Now the help message of namespace and resource_type are wrong, we could see a <unavailable> error when try to get the help information, such as "glance help md-namespace-create". See the patch[1] to get more information. the patch[1] added image schema, but the metadata schema are needed as well. This patch adds the current metadata schema into client, so that help text can't be rendered when there schema is not available in the system. [1]: https://review.openstack.org/#/c/209536/3 Change-Id: I2ab94d8768114a7e5c475310ba094af653627658 Closes-Bug: #1536430
* Merge "Fix location update"Jenkins2016-03-111-0/+4
|\
| * Fix location updateFei Long Wang2016-03-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit Ieb03aaba887492819f9c58aa67f7acfcea81720e, the command location-update is totally broken now. This patch removes the updating for an image from non-empty to empty since it's not supported now. And also removing the default value of metadata for location-update cli command because now the only purpose of location-update is updating the location's metadata, so it doesn't make sense to give it a default value which may update existing metadata by mistake. Closes-Bug: #1537626 Change-Id: I9ce98e6c63996bbfdbc56761055e37a871f9d3e2
* | Catch InUseByStore case in do_image_deleteDanny Al-Gaaf2016-03-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | In case do_image_delete() is called on an image that is in use and can't be deleted by the driver a HTTPConflict error is raised in glance. Catch this error and print a propper error message. Closes-Bug: #1551037 Change-Id: Id17098f27511df8e05e56b8df21e748921223bd9 Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
* | Merge "Handle 403 forbidden on download"Jenkins2016-02-291-1/+6
|\ \ | |/ |/|
| * Handle 403 forbidden on downloadStuart McLaren2016-02-241-1/+6
| | | | | | | | | | | | | | | | | | | | A download of a deactivated image may result in a 403. The cli should catch this error rather than stack trace. We also catch other unexpected http responses. Change-Id: If33fbc3a56cdb02b3ab32a6479a67fff20b4b1a9 Closes-bug: 1523612
* | Change metavar for location commands in V2kairat_kushaev2016-01-201-3/+3
| | | | | | | | | | | | | | | | | | Currently location-add, location-delete and location-update shows <ID> in help messages as metavar for image id. It may be not clear to the users so we need to change this to <IMAGE_ID>. Change-Id: I59c787e449fa34bc792de179993c55f59734b9fe Closes-Bug: #1535220