summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/image/v2
Commit message (Collapse)AuthorAgeFilesLines
* Blacken openstackclient.imageStephen Finucane2023-05-104-361/+312
| | | | | | | | | | Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I6420ec6fd550903b03083b9b1f8391511913c86f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Adding ``image import`` commandMridula Joshi2023-04-121-4/+4
| | | | Change-Id: I7254d30431894879c8bd20e2263d83b12c99d5c8
* Merge "image: Add support for additional image import methods"Zuul2023-01-251-4/+16
|\
| * image: Add support for additional image import methodsStephen Finucane2022-11-301-4/+16
| | | | | | | | | | | | | | | | These are now supported in openstacksdk so we can use them. Change-Id: Ie3107ba2155f9008e6065171298f85978957a172 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Depends-on: https://review.opendev.org/c/openstack/openstacksdk/+/864029
* | Merge "image: Fail if we can't find an image"Zuul2022-12-201-1/+4
|\ \
| * | image: Fail if we can't find an imageStephen Finucane2022-12-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Whenever we attempt to find a provided image, we generally want to fail fast if they can't be found. This wasn't happening. Fix it. Change-Id: Ibea38354a78381cb87d287f03726ecd03ecd246d Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "Add image metadef namespace command"Zuul2022-12-152-3/+156
|\ \ \ | |_|/ |/| |
| * | Add image metadef namespace commandhoosa2022-12-072-3/+156
| |/ | | | | | | | | | | add image metadef namespace create, delete, set, show command Change-Id: I35b1cb8ff2b1735ae3a1b405d8f2071fe449ea6e
* | image: Add 'image import' commandStephen Finucane2022-11-092-5/+223
|/ | | | | | | | Note that we require some additional functionality in SDK for this to work properly, but it's a start. Change-Id: I87f94db6cced67f36f71685e791416f9eed16bd0 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* image: Add 'image stage' commandStephen Finucane2022-11-092-25/+80
| | | | | | | This is the equivalent of the 'image-stage' glanceclient command. Change-Id: I10b01ef145740a2f7ffe5a8c7ce0296df0ece0bd Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* image: Simplify handling of data provided via stdinStephen Finucane2022-11-091-64/+30
| | | | | | | This was unnecessarily complex. Change-Id: I8289d5ce7356d8bc89425590a7f71bca91a6d396 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* image: Ignore '--progress' if providing image data from stdinStephen Finucane2022-11-091-0/+31
| | | | | | | | You can provide data via stdin when creating an image. Using this with '--progress' makes no sense and causes an error currently. Fix this. Change-Id: I3c2d658b72a7c62931b779b0d19bb97f60a0c655 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Added "openstack image metadefs namespace list" commandAreg Grigoryan2022-10-262-0/+121
| | | | | Change-Id: Ibc064566478818bd70e7e6550095d24a05e1bb0e Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/854612
* Merge "Fix wrong assertion methods"Zuul2022-09-301-1/+1
|\
| * Fix wrong assertion methodsTakashi Natsume2022-09-231-1/+1
| | | | | | | | | | | | | | Change-Id: Iebf4840662e87e59a06b56f1b5248728cba03c24 Story: 2010288 Task: 46261 Signed-off-by: Takashi Natsume <takanattie@gmail.com>
* | image: Add 'image task list' commandStephen Finucane2022-09-212-1/+127
| | | | | | | | | | | | | | | | | | | | | | | | This replaces the 'glance task-list' command. $ openstack image task list We also indicate that the 'image task create' command will never be implemented. This is an admin-only API that isn't really intended to be used by humans thus it does not need an OSC command implementation. Change-Id: Id8a943a5443782fc70c0fbf3639f5aa17b9d30af
* | image: Add 'image task show' commandslsmman2022-09-212-0/+134
|/ | | | | | | | This replaces and the 'glance task-show' command. For example: $ image task show <TASK_ID> Change-Id: I74cb23e436c373fe238804b903bbeb28f643d5af
* image: Make better use of argparseStephen Finucane2022-06-301-80/+36
| | | | | | | | Simplify some logic by using a common 'dest' for mutually exclusive options. Change-Id: Ie5f3600672953f40be52de51e84717c8912ddaf8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Fix: create image from volume commandwhoami-rajat2022-06-301-1/+105
| | | | | | | | | | | | | | | | | | Currently the command ``openstack image create --volume`` calls cinderclient to upload the volume to image service (glance) but OSC passes ``visibility`` and ``protected`` fields which are only available in microversion 3.1 or greater. This generates an error if the user is using volume microversion < 3.1 and wants to create an image from volume. This patch fixes that by only passing ``visibility`` and ``protected`` fields when the volume microversion is 3.1 or greater and fail otherwise i.e. the following 3 cases: 1) visibility/protected argument + mv >= 3.1 = pass 2) visibility/protected argument + mv < 3.1 = fail 3) not visibility/protected argument + any mv = pass Story: 2010060 Task: 45511 Change-Id: I568a0ea0af8f7f82b16d49a6a1bb0391b99c50dc
* Allow users to list all imagesCyril Roelandt2022-06-071-0/+32
| | | | | | | | Add a "--all" option to "openstack image list", which allows the user to list all of the images. Story: 2010071 Change-Id: I56a2e4846d0380d07803305fb830d1a43dfd71b3
* Allow to filter multiple tags for image listDmitriy Rabotyagov2022-05-161-2/+3
| | | | | | | | | Currently in case of passing `--tag` several times, only last one will be picked up for the filtering. In the meanwhile Glance allow option to be repeated multiple times to filter based on the multiple tags. Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/789827 Change-Id: I7379d0b0014f0e3d13b02ee5ec6b642a7a5aa7d1
* image: Sanity check the 'SetImage' commandStephen Finucane2021-11-171-9/+3
| | | | | | | | | This was a very difficult command to grok, due to the layering on of additional features over the years. Make this a little easier to follow by grouping related logic and making use of argparse features. Change-Id: I4e1a0aed09ea5d6a8c26ec3e888c9c7b6cefc25a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* tests: Update fake image client in testsStephen Finucane2021-11-172-28/+22
| | | | | | | | | | | These clients are intended to fake out the old glanceclient client which we no longer use. They were only "working" because we weren't actually using any of the glancelclient-based stuff and were instead overriding everything within the tests. Move these overrides back to the main fake client and remove the crud. Change-Id: I92ee74a1df72a6dd23f9d2dc04342aab0cbd3210 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* image: Remove FakeImage test helperStephen Finucane2021-11-172-142/+125
| | | | | | | | | We're no longer creating fake versions of glanceclient's 'Resource' object but rather openstacksdk objects. As such, there's no point nesting things under a fake resource class. Change-Id: I39cd5302622f4542db9eebcccfad0cb90d077441 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* image: Remove dead test helper methodsStephen Finucane2021-11-171-173/+0
| | | | | | | | | These haven't been used since we switched the image commands from glanceclient to openstacksdk. There's more cleanup to be done here but that can be done later. Change-Id: I3de1f24323886b122b3a30660fb3de18eb7014e9 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Remove non-working code after method return.lsmman2021-10-061-5/+0
| | | | | | | | | | | | Delete duplicate return code. While adding return of a new Member type, the existing return code part is not deleted. Note the code in fakes.py in the below commit where these codes were added. - Project: python-openstackclient - The commit: 60e7c51df4cf061ebbb435a959ad63c7d3a296bf Change-Id: Iae44770a784732991962cd38472095f76ab2543f
* Replace assertItemsEqual with assertCountEqualDirk Mueller2021-05-031-12/+12
| | | | | | | | | | | | | | | assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I0bbffbec8889b8b3067cfe17d258f5cb16624f38
* Implements hide imageValery Tschopp2021-03-251-0/+68
| | | | | | | | | openstack image set [--hidden|--unhidden] IMAGE openstack image list --hidden Task: 41734 Story: 2008581 Change-Id: Ie84f10c0f7aa2e7b7f78bfadc70132a10673866e
* Merge "image: Unset properties rather than setting to None"Zuul2021-01-061-16/+13
|\
| * image: Unset properties rather than setting to NoneStephen Finucane2020-12-221-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we attempt to unset an image property by setting it to None. This doesn't work for known properties and is rightly rejected by the Glance API with the following error: BadRequestException: 400: Client Error for url: http://172.20.4.87/image/v2/images/368c5751-2b0b-4a38-a255-fd146fe52d31, Bad Request The solution is to actually unset the field by deleting it. Change-Id: Ie156bedbe0f9244f82c81401679706f484caf9aa Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2008463 Task: #41493
* | Add project field in image list subcommandokozachenko2020-12-151-0/+15
|/ | | | | | The motivation is to filter the image by owner Change-Id: I1f08da175a06e62a844f76b0ec18cb3332efef86
* Make use of comparable 'FormattableColumn' subclassesStephen Finucane2020-12-091-11/+11
| | | | | | | | | | | | This requires fixes found in cliff 3.5.0 [1] and osc-lib 2.3.0 [2]. With these fixes in place, we can remove the icky, still broken 'assertItemEqual' and 'assertListItemEqual' helpers. [1] https://review.opendev.org/761421 [2] https://review.opendev.org/761394 Change-Id: Id6c26b37c3c7d5ec6761361abca57f9219b76838 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* stop image downloads to memorySimon Merrick2020-11-251-1/+2
| | | | | | | | | | + Fixes issue with large images hogging memory + stream image downloads + output to stdout if file not specified Change-Id: Ia01ff9b21a2dac5d0ccf2bd58a8640e88c5cbb36 Story: 2007672 Task: 39776
* Restore behavior of image create with same name.Sam Morrison2020-10-061-1/+5
| | | | | | | | | | | With 60e7c51df4cf061ebbb435a959ad63c7d3a296bf the behaviour of `openstack image create` changed so that you can't create an image with the same name. This patch restores the previous functionality. Story: 2008229 Task: 41069 Change-Id: Ia0f4920371a918e94d1ccf9fcfcbf90ff885a455
* Expose flag for forcing use of import for imagesMonty Taylor2020-06-301-0/+22
| | | | | | | | | | openstacksdk added support for using image import as a fallback which is transparently supported here, but also provides an override flag to allow a user to force use of import. Expose that here. Depends-On: https://review.opendev.org/737608 Change-Id: Ied938a8f63f305305a20ace42e9f4c84b0a5c00e
* Switch image to use SDKArtem Goncharov2020-03-232-278/+293
| | | | | | | | | | | | | This is a work to switch OSC from using glanceclient to OpenStackSDK. With this change only v2 is using OpenStackSDK. V1 is still using glanceclient and will be switched in a separate change. Remove the direct depend on keystoneauth- let that flow through openstacksdk. Depends-on: https://review.opendev.org/#/c/698972 Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
* Raise flake8-import-order version to latestSean McGinnis2020-01-102-2/+2
| | | | | | | | | | | We had this library capped at a release that is a few years old. Now that we have dropped py2 testing, we can pick up the latest version. This uncovered a few things to clean up. Mostly the fact that mock is now a part of the StdLib unittest since Python 3.3. Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Use cliff formattable columns in image commandsAkihiro Motoki2019-06-222-16/+16
| | | | | | | | | | Related functional tests are converted into JSON format. Otherwise, it is not easy to check results. Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: Ib82e15738544975fede0c54cc5eaf239f4c67277
* Remove deprecated image commandsDean Troyer2019-05-191-52/+0
| | | | | | | * Remove ``image create|set`` option ``--owner`` Change-Id: I1fabab98c8660eba6d0dd75e74544c6c9d432b9e Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Remove code migrated to osc-lib long agoDean Troyer2019-05-161-1/+1
| | | | | | | | | * Remove openstackclient.api.utils and use osc_lib.api.utils * Remove openstackclient.common.clientmanager.ClientManager.auth_ref * Remove openstackclient.common.commandmanager Change-Id: I67e1dbc53cc0b37967c0011bcb2fc09bdef62d94 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Merge "Fix --limit option in image list sub-command"Zuul2019-05-081-4/+5
|\
| * Fix --limit option in image list sub-commandRadoslaw Smigielski2019-02-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Client site fix of --limit option. This bugfix makes client "image list" command working again with "--limit" option. This option was ignored and even if user specified it, still list of all available images was returned. Story: 2004314 Change-Id: I30a78d65a644c9b7d23706a6637ce77bca2c2386 Depends-On: https://review.openstack.org/#/c/634776/
* | Add possibility to filter images using member_statusArtem Goncharov2019-02-261-0/+43
|/ | | | | | | | | In order to see image sharing membership it is required to additionally pass member_status filter to API. Otherwise only those with status 'all' will be returned. Thus adding possibility to see images shared with project to be approved or rejected. Change-Id: Ifd6e13e5a4ef09fbc29e76d464c93fbdbb178ae4
* Merge "Support --community in openstack image list"Zuul2018-07-251-0/+29
|\
| * Support --community in openstack image listNobuto Murata2018-07-241-0/+29
| | | | | | | | | | | | | | | | | | "--community" was added to "image create" and "image set" previously, but was missed in "image list". Change-Id: I959fdd7f67ae62c8326659ce52389228152ec019 Story: 2001925 Task: 14453
* | Fix error with image show when image name is NoneJake Yip2018-07-231-1/+2
|/ | | | | | | | Need to bump osc-lib to 1.10.0 Closes-Bug: #1736696 Depends-On: I2aab5cc1f550848bda2b90ef7ef9a60f07b88996 Change-Id: I7420204f28d36529354e5671bd88587d9b15bb06
* Add ability to filter image list by tagAdam Harwell2018-06-281-0/+14
| | | | Change-Id: I2e222d3e69df9d8d7cd472663caaee31bedd848c
* Add support to list image membersMohammed Naser2018-03-211-0/+46
| | | | | | | | The OpenStack client presently has support to add or remove members from an image, but no way to list image members. This patch addreses this issue. Change-Id: Ie85c5de23c6beb21fd6b4c04c83ddf2a116606ef
* Check that Glance returns image data before processing itMike Fedosin2018-01-051-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | Now if Glance v2 cannot find image data it returns an empty response with 204 status code, instead of raising an error. Glance client handles this situation and wraps the response with a RequestIdProxy object, whose 'wrapped' attribute is None. But when openstack client tries to parse this object using glanceclient's save_image util function, it fails with "NoneType object is not iterable" message, for the object doesn't contain any data. This patch adds additional check to prevent such behaviour and raises SystemExit exception if no data was returned from the server. Glance v1 is not affected, because it raises an error if can't find an image data. Change-Id: I016a60462ba586f9fa7585c2cfafffd7be38de7b Closes-Bug: #1741223
* Merge "Accept 0 for --min-disk and --min-ram"Zuul2017-10-211-0/+26
|\