summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/image
Commit message (Collapse)AuthorAgeFilesLines
* 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-032-17/+17
| | | | | | | | | | | | | | | 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-092-16/+16
| | | | | | | | | | | | 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
* Complete switch from glanceclient to SDK for image serviceArtem Goncharov2020-03-242-111/+72
| | | | | | | | | In https://review.opendev.org/#/c/650374/ a work has been started to switch image service support from glanceclient with all it's dependencies to the SDK version. With this change version 1 (anyway deprecated since ages) is also being switched to SDK. Change-Id: Ic391500af02a73d81d64a9e9113cca85c9e24390
* 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-104-6/+4
| | | | | | | | | | | 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-223-26/+28
| | | | | | | | | | 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-162-2/+2
| | | | | | | | | * 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-212-0/+52
|\
| * Accept 0 for --min-disk and --min-ramShogoAdachi2017-10-202-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current openstackclient implementation cannot accept 0 for --min-disk and --min-ram with the "openstack image set" command. If theses options get set to 0, the option parser in openstackclient wrongly interprets 0 as no option value. The 0 is valid for these options if administrators want to make it the default(no minimum requirements). This patch fix the parser so that it avoids only 'None'. Change-Id: Ie8ee37484c02c26f54adc56263fcd167c0ce7eb3 Closes-bug: #1719499
* | Fix 'project purge' deletes ALL images problemlihaijing2017-09-262-0/+2
|/ | | | | Closes-Bug: #1717130 Change-Id: I33c6fc7897dfee85d1c197a1267bde4abfa5bbd9
* Use flake8-import-order pluginAkihiro Motoki2017-08-174-4/+5
| | | | | | | | | | | | | | | | In reviews we usually check import grouping but it is boring. By using flake8-import-order plugin, we can avoid this. It enforces loose checking so it sounds good to use it. This flake8 plugin is already used in tempest. Note that flake8-import-order version is pinned to avoid unexpected breakage of pep8 job. Setup for unit tests of hacking rules is tweaked to disable flake8-import-order checks. This extension assumes an actual file exists and causes hacking rule unit tests. Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
* image-list should support filters 'name','status'nidhimittalhada2017-07-121-0/+28
| | | | | | | | | nova api support parameters like 'name', 'server', 'status', etc in image-list(). So openstackclient should support this too. DocImpact Closes-Bug: #1698742 Change-Id: Ice66b409f989e6785aa3b2d42f2fdbf6e23fa0aa
* Merge "To display image size in human friendly format"Jenkins2017-06-014-4/+60
|\
| * To display image size in human friendly formatBadhmapriya Boopalan2017-01-114-4/+60
| | | | | | | | | | | | | | | | | | | | Include option '--human-readable' to 'image show' command. This option displays image size in human readable format (such as K, M, G, T,..) Related Commit: I0ef74c2ec978483fe49156c88acf5c369a8fa5c2 Closes-Bug: #1640086 Change-Id: I28cd5702925d51303d0607ed8dccf12c56434682
* | Trivial fix typosVu Cong Tuan2017-05-301-1/+1
| | | | | | | | Change-Id: I72a1da209df38e226ec02d9dbd0142ed4020c0d2
* | doc: Correct Sphinx warningsStephen Finucane2017-03-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix option-describe typos - Correct option and envvar markup, for commands that are using the reference form instead of the definition form or are marking up option arguments as options - Avoid duplicate commands - Fix some invalid docstrings - Fix some invalid indentation - Disable the murano plugin, which has invalid docs - Correct issues with- and track the network-topology spec - Include API modules in docs Change-Id: I3d5ed5e872540fe13f3e4bd5e9335829dc9a5226
* | Fix image member unit tests occasional failuresDean Troyer2017-01-121-20/+87
| | | | | | | | | | | | | | Let's try just unrolling the member status tests and not getting too fancy here. Change-Id: I30022ebd2da6d6cf1abba424d7d7fa679285f291
* | Add support for Glance 'update image members' featureJordan Pittier2017-01-041-0/+33
| | | | | | | | | | | | | | | | | | This patch adds 3 new options to the "image set" command: --accept, --reject and --pending. This updates the membership status for an image. Closes-Bug: 1620481 Change-Id: I13b8c067aad68ece9ff636fbdd83bcb3663c91b2
* | Revert "Remove marker and loop from "image list" command"Steve Martinelli2016-12-051-5/+16
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 0b6fdcbe4c3f3142fdd18bfd827653d894607941. Adapt "image list" to not loop when --marker is specified on command line. Update tests to work with current state of code. Change-Id: I8af58adf8637a9e34371c6280db40935d22bc3c3
* | clean up image choices and help textSteve Martinelli2016-11-232-10/+10
|/ | | | | | | | | | | Use choices for image set and image create commands, this aligns with our use of choices in networking commands. Also update the help text to match that of the networking commands, where we iterate through the options. Related-Bug: 1635518 Change-Id: Ib4c66b06e07f1d4e5bfe1b74053f2215cccad890
* Refactor image v1 unit tests with FakeImage classHuanxuan Ao2016-10-092-95/+185
| | | | | | | | Add FakeImage class, and refactor the unit tests with it in image v1. Change-Id: I9024ca5eca5c604e7588c1d905562bf6838309f1 Implements: bp improve-image-unittest-framework
* Replace 'MagicMock' with 'Mock'qtang2016-09-142-2/+2
| | | | | Change-Id: I7aeceede6bd3cb88cf04f398454f9758dbee20f1 Closes-Bug: #1475722
* move unit tests to new "unit" test moduleSteve Martinelli2016-09-087-0/+2402
this will better isolate the unit tests from the functional tests. unfortunately, the "integration" tests had to be lumped into the "unit" tests since we need the separation in testr.conf Change-Id: Ifd12198c1f90e4e3c951c73bfa1884ab300d8ded