162 Commits

Author SHA1 Message Date
Sam Morrison
17678c9bd6 Restore behavior of image create with same name.
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
2020-10-06 14:05:11 +11:00
Zuul
8aed5feab8 Merge "Fix uploading an signed image does not work if private signing key is encrypted" 2020-07-08 17:30:38 +00:00
Alexander Gräb
c06d825635 Fix uploading an signed image does not work if private signing key is encrypted
Change-Id: Ia7c84aa7b840bf92aeb7db7246d14119eb727b03
Story: 2007890
Task: 40269
2020-07-07 13:26:51 +02:00
Monty Taylor
c04ec16cf7 Expose flag for forcing use of import for images
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
2020-06-30 07:02:23 -05:00
Dmitriy Rabotyagov
042be7c7fe Don't look up project by id if given id
There is a much deeper and systemic issue going on here, but let's
start with fixing the immediate issue which is that adding a project
to an image fails trying to look up project information even if the
user passes the project id by id.

_is_uuid_like from sdk isn't perfect, but it'll be good enough
for this.

Change-Id: I541416d737b961c56aa2f584c172528632fd5537
2020-03-24 13:13:12 +00:00
Artem Goncharov
768a64aac5 Complete switch from glanceclient to SDK for image service
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
2020-03-24 13:13:06 +00:00
Artem Goncharov
60e7c51df4 Switch image to use SDK
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
2020-03-23 14:38:32 -05:00
lihaijing
d15bbada73 Replace six.iteritems() with .items()
1. As mentioned in [1], we should avoid using six.iteritems to achieve
   iterators. We can use dict.items instead, as it will return iterators
   in PY3 as well. And dict.items/keys will more readable.

2. In py2, the performance about list should be negligible,
   see the link [2].

[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
2020-01-09 18:41:29 +09:00
Akihiro Motoki
8d63e3f0c3 Use cliff formattable columns in image commands
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
2019-06-22 13:36:46 -05:00
Dean Troyer
67dadda746 Remove deprecated image commands
* Remove ``image create|set`` option ``--owner``

Change-Id: I1fabab98c8660eba6d0dd75e74544c6c9d432b9e
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-05-19 17:06:19 -05:00
Dean Troyer
1b2595a959 Remove code migrated to osc-lib long ago
* 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>
2019-05-16 19:19:58 -05:00
Zuul
ba66cdfcfa Merge "Fix --limit option in image list sub-command" 2019-05-08 23:25:16 +00:00
Zuul
8159fc216d Merge "Add possibility to filter images using member_status" 2019-03-07 00:34:17 +00:00
Artem Goncharov
444a40c656 Add possibility to filter images using member_status
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
2019-02-26 11:13:25 +01:00
David Rabel
55cbbbe469 Fix help message of image add project
Only with the admin role you can use the project name with
'image add project'. With the normal member role you have to
use the project id instead. If you try to use the name, you
don't receive an error, but it won't work.

Change-Id: I2d11c07a256917d12c46a7c302c5a5e8752a1df0
Task: 29543
Story: 2002535
2019-02-19 12:49:18 +01:00
Radoslaw Smigielski
aaf73cbf6d Fix --limit option in image list sub-command
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/
2019-02-04 18:52:13 +00:00
Sven Wegener
21e4c87bde
image/v2: support multiple property filters
Change-Id: I8ba40cb8ca647ec24b80c2824bb64e84430535d4
Signed-off-by: Sven Wegener <sven.wegener@inovex.de>
2018-11-07 14:55:51 +01:00
Josephine Seifert
1981eb2250 osc-included image signing (using openstacksdk)
This extension adds image signing functionality to the "image create" command.
Therefore, new CLI options --sign-key-path and --sign-cert-id have been added.
This patch uses openstacksdk as the signing backend library instead of cursive.
Therefore, requirements and lower_constraints have been updated to use the
openstacksdk version 0.17 or higher.

Depends-On: Idc15b9a12d408bd4b2e096da8402c374be56f9fa
Change-Id: Ia20bc02a49c3fbeb9222e485e3396395f4ab817a
Story: 2002128
Co-Authored-By: Markus Hentsch <markus.hentsch@secustack.com>
2018-09-08 01:55:38 +00:00
Zuul
cc037e22a6 Merge "Support --community in openstack image list" 2018-07-25 02:49:02 +00:00
Nobuto Murata
860639a548 Support --community in openstack image list
"--community" was added to "image create" and "image set" previously,
but was missed in "image list".

Change-Id: I959fdd7f67ae62c8326659ce52389228152ec019
Story: 2001925
Task: 14453
2018-07-24 22:48:01 +00:00
Jake Yip
b90b93e143 Fix error with image show when image name is None
Need to bump osc-lib to 1.10.0

Closes-Bug: #1736696
Depends-On: I2aab5cc1f550848bda2b90ef7ef9a60f07b88996
Change-Id: I7420204f28d36529354e5671bd88587d9b15bb06
2018-07-23 17:42:34 -05:00
Adam Harwell
9edbab8c90 Add ability to filter image list by tag
Change-Id: I2e222d3e69df9d8d7cd472663caaee31bedd848c
2018-06-28 16:17:14 +00:00
Sean McGinnis
d601415259 Clean up W503 and E402 pep8 errors
pycodestyle 2.40 and later enforce these rules that were not previously
enforced. Rather than just skipping them, this cleans up the trivial
instances of these violations.

This does also include some other updates that were not triggering errors
in an attempt to keep some of the style consistent.

Change-Id: Id7c0a6b8f1f835e69d844b000e3ed751852ada63
Closes-bug: #1762803
2018-04-15 12:23:06 +09:00
Zuul
972a345014 Merge "Add support to list image members" 2018-04-02 19:05:15 +00:00
Mohammed Naser
79577681d8 Add support to list image members
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
2018-03-21 08:56:08 -04:00
Dean Troyer
6df58b6366 Fix additional output encoding issues
This is a followup to https://review.openstack.org/#/c/541609/ that
changes most outstanding direct uses of sys.stdout to use the encoded
stdout set up by cliff.

Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
2018-03-20 15:40:23 -05:00
Zuul
7d50e5fc9a Merge "Replace assert with condition" 2018-01-22 17:56:31 +00:00
Pavlo Shchelokovskyy
ca90985f4e Replace assert with condition
a piece of code in image client has some business logic behind
assert, which can be lost when running python in optimized mode (-O).

Change-Id: I2179970df495e1215d691915c51cebe5cb4541a7
2018-01-22 12:26:17 +02:00
Mike Fedosin
ed1b59848f Check that Glance returns image data before processing it
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
2018-01-05 19:36:49 +01:00
ShogoAdachi
4464109c77 Accept 0 for --min-disk and --min-ram
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
2017-10-20 19:48:37 +00:00
lihaijing
ff91e26983 Update image cli doc and fix some typos
Change-Id: I0a8d095e51a96804c97612e28fac2d00aa94c638
Closes-Bug: #1711284
2017-08-25 08:08:31 +08:00
lihaijing
d33ab499ed Fix "openstack image unset" command's help message typo
Change-Id: Ie286d9ee6054cc2126473d7e6e77bafbfd80023b
Closes-Bug: #1712473
2017-08-23 12:59:46 +08:00
nidhimittalhada
bca8d57eb3 image-list should support filters 'name','status'
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
2017-07-12 22:50:17 +00:00
M V P Nitesh
3468ea1ca4 Added 'openstack image set --visibility'
This feature will allow image owners to share images across multiple
tenants/projects without explicitly creating members individually
through the glance API V2. “Community images” will not appear iu
user's default image listings

Change-Id: Ic02bf44cca5d6d793d68a8737d3cfe3f44407d88
Closes-Bug: #1626837
2017-06-30 20:35:01 +00:00
Jenkins
3707717f8f Merge "To display image size in human friendly format" 2017-06-01 17:48:11 +00:00
Dean Troyer
1686dc54f0 Help/docs cleanups: marker, limit, ip-address metavars
Cleanup help strings and docs for clarity and to keep things consistent:
* --limit metavar should be <num-resource> to indicate what is being counted
* --marker metavar should be <resource> or <resource-id> to indicate the
  type of value being specified
* <*-ip-address> metavars should be just <ip-address> as there is no difference
  in format between fixed and floating IPs
* Move all occurances of '(name or ID)' to end of help text

Change-Id: I2c31746ed6ded3845244e03e57d809f8bc0e6b9d
2017-04-04 03:56:19 +00:00
David Rabel
4ea4f6fabb openstack image create : --file and --volume exclude each other
Added parser.add_mutually_exclusive_group() for --file and --volume
in openstack image create.

Change-Id: I4d9fc6314801d569354e5644e231ddd6c7f1853d
Closes-Bug: 1666551
2017-02-24 08:50:37 +01:00
Brian Rosmaita
80c62021c8 Update container format choices
The choices for valid container formats is out of date in the
image v1 and v2 help text.  This patch adds 'ova' and 'docker'
and does some minor refactoring to align the container_format
option with the disk_format option.

Change-Id: Icdea5fab801abd651baf45cf96c920c7df79f11b
Closes-bug: #1658138
2017-01-23 23:04:49 -05:00
Badhmapriya Boopalan
6962cc963e To display image size in human friendly format
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
2017-01-11 02:09:02 +00:00
Jordan Pittier
f055fe67c1 Add support for Glance 'update image members' feature
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
2017-01-04 19:26:01 +01:00
Mikhail Feoktistov
63377f25fc Add ploop to supported disk formats
This format is used for containers for Virtuozzo hypervisor

Closes-Bug: 1650342

Change-Id: Ic79f29a1fe9ea5016d3d5520c2b06e39da01ff61
2016-12-15 12:46:55 -05:00
Jenkins
fdf93e04e6 Merge "Revert "Remove marker and loop from "image list" command"" 2016-12-05 22:21:47 +00:00
Steve Martinelli
42f33435ed Revert "Remove marker and loop from "image list" command"
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
2016-12-05 10:35:00 +01:00
Jenkins
7078502ea6 Merge "Sort list images by name by default" 2016-12-02 18:50:17 +00:00
Jenkins
19ca396508 Merge "Using v2 as the default version of Glance" 2016-12-02 18:29:08 +00:00
Steve Martinelli
f15352f861 clean up image choices and help text
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
2016-11-23 22:52:33 +05:30
Jenkins
bf6f4bb58b Merge "Show disk format vhdx in help" 2016-11-22 15:39:47 +00:00
Vijendra Soni
a7a0d0c61a Sort list images by name by default
Set the default key and dir for openstack image list,
if no command line argument passed
Changing sort_key to name(old value: created_at)

Change-Id: I6c61f6e5a04824d655ccf43477afcec9652101df
Closes-Bug: #1639231
2016-11-21 20:19:53 +05:30
Fei Long Wang
4bce716733 Using v2 as the default version of Glance
Glance API v1 has been deprecated, so it's better to use v2 as
the default API version in openstackclient.

Closes-Bug: 1642772

Change-Id: I7d9e3228a2f3a3d0da437b7ee6f23e528de27fd3
2016-11-18 12:58:31 +00:00
Steve Martinelli
0ef8535036 translate all command help strings
Leverage the new cliff command class attribute (_description)
to get the help of a command, this allows us to mark strings
for translation. We could not do this before since the help
was grabbed from the docstring.

This also depends on a new release of cliff and a bump to the
minimum level in osc's requirements.

Closes-Bug: 1636209
Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da
Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
2016-11-17 02:33:42 +00:00