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
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>
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
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
Related Change: If79779a4c52c8dc5c4f39192d3d247335a76ba24
This help is also used for OpenStack Command-Line Interface Reference.
Change-Id: Iadce779afebe4aa80026e46f169546aba9055477
Partial-Bug: #1432813
When the image locations are blank, glance client will get a http response
with no content, glance client should show user no data could be found,
instead of processing the blank response body that will lead to exception.
Glance client will also get a 204 response when an image is in a queued
state (this is true for 'master' and liberty/kilo/juno based servers).
Closes-Bug: #1472449
Co-Authored-by: Stuart McLaren <stuart.mclaren@hp.com>
Change-Id: I5d3d02d6aa7c8dd054cd2933e15b4a26e91afea1
The help for image-create states that --file 'Must be present if images
are not passed to the client via stdin.'
However, doing image-create without --file is a valid operation - it
queues a file to be created.
Change-Id: I8167c6a891fa2540c84e3b888031d90a34a9b5fc
Add translation support for v2 shell help messages. It allows
to detect the messages that needs to be translated for translation
team.
Change-Id: Id1fb0355090d4e223d13c15100e6726e15563670
Client doesn't support image deletion in batches in v2 now.
It's useful. So it's need to add it.
Change-Id: Idf5a6890b3fd01a65fecab2033b21367c30bc6b1
Closes-bug:#1485407
Self is not meant to exist as it is a READ ONLY property, that is not
meant to exist as something the user can change.
Closes-bug: 1496024
Change-Id: I28fd51a4cbef40fc7c90999fe8121611c7f89f21
Command help message uses help and CLI-Reference generation.
and in convention, help message stops with period ".".
Change-Id: I652afdb5e4d69a0476a0a2dc313ae60ece3b7bbc
The client currently downloads the image metadata to check if it's deleted
or not. This logic belongs to the server and it's already implemented
there. Instead of getting the image, send the delete request and catch
the 404 error, which is already raised by the server.
Change-Id: I1e6ef42340f8e380ff99b9d6ca7ea416e0eebfbc
Closes-bug: #1496305
When querying against a Juno glance-registry, we found that having the
--sort option defaulting to 'name:asc" results in querying the registry
with additional SQL parameters like the following:
WHERE image_properties_2.name = :name_1 AND image_properties_2.value =
:value_1
as a result of handling the newer 'sort' filter. This results in a
blank list being returned as the output of glance image-list.
This patch sets the --sort-key and --sort-dir instead of --sort when
neither --sort-key nor --sort-dir are specified, so as to maintain
backwards compatibility with Juno glance-registry.
Change-Id: I8bd64cca7f1b7abdbabf4c09e3dbbcb4044e51b4
Closes-bug: #1492887
In v2, it's only show Id and Name. When use --verbose, although added
owner and status, it's still lack of Disk-format,Container-format and
Size.
Change-Id: I26b4b7bd3a3f6dbf82ca73c32dd94c56e8e173a1
Closes-bug:#1486329
Currently glanceclient doesn't enforce disk-format or container-format
presence in the command line on image-create when providing image data
(with --file, --location, --copy-from), which means that the POST
request is made with the whole image and error is reported by Glance
API.
This post enforces presence of those arguments when image data is
provided so we can get the error quicker and avoid sending unnecessary
data over the network.
Change-Id: I5914fa9cfef190a028b374005adbf3a804b1b677
Closes-Bug: #1309272
Now that we have stable branches for clients, it's easier to keep track
of the current default image's schema in Glance and update it
respectively. This patch adds the current image schema, including the
schema-properties.
One good reason to do this is to be able to react when a running Glance
instance is not around to be introspected. It's really unfortunate that
things like help text can't be rendered when there image schema is not
available in the system.
We could keep the schema in a json file but rather than shipping data
files with glanceclient we can just have it in the python modules.
Change-Id: I9b8cc1d18d6717ccf991fb8149ab13c06d653ee4
Closes-bug: #1481729
This set provides API and shell commands support for:
- CRUD on metadef_tags;
Change-Id: I09bdf43edee6fff615d223f1a6df7c15a1e40565
Implements: blueprint metadefs-tags-cli
DocImpact
As stated in the OpenStack Hacking Guidelines, it is prefered
that only modules should be imported.
Also updated tox.ini to ignore opestack/common among others.
Change-Id: I2f0a603c31052eadee581c11880c0ec6bd392829
Show the owner and status information when adding -v or --verbose
to the image-list command.
Closes-bug: #1381514
Change-Id: I90bf622147b12ed157072fad0823af58223caf91
Currently when you download an image without specifying
a file or redirecting the output, the image is dumped into
the console as gibberish. We can avoid this if we
check if file is being redirected or if a file is specified.
Change-Id: I257760752f05b82b935cf19fb10573ee7ff1395d
Based on current implementation, locations is reserved
attribute, so it should not be a parameter for image
create.
Closes-Bug: #1399778
Change-Id: Ie51e52157e905fdecf736125be0dac87b1a966ec
Added option '--human-readable' to image-show cli which allows users
to display image size in human-readable format.
Change-Id: Ic3452ce4560d3cf90fa7f59f98e5ff42e804f8c9
Closes-Bug: #1434381
help message for v2 glance member-update api
now displays the Valid Values of member status
variable.
The valid values are: pending, accepted, rejected
Change-Id: Ibe6f55c933668451b407ed9a19c520c3fbf1912a
Closes-bug: #1420707
This code enables new syntax for sorting output with multiple
keys and directions based on API Working group sorting
guidelines.
It's a client code to consume API modified in change
Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb
Example:
glance --os-image-api-version 2 --sort name:desc,size:asc
Implements-blueprint: glance-sorting-enhancements
DocImpact
Depends-On: Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb
Change-Id: I36a9fa9f0508fea1235de2ac3a0d6a093e1af635
Previously this was read from the --page-size argument, which lead to
incorrect behaviour.
Change-Id: I08ecda95eca0ff524e28a1d5371ce6c73dfc548e
Closes-Bug: #1429088
os.path.isfile checks for existance anyway so
there is no point in checking both isfile and exists
Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3
Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."
Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.
Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
In v2, we use the link header during paginations to know when there are
more images available in the server that could be returned in the same
request. This way, it's possible to iterate over the generator returned
by list and consume the images in the server.
However, it's currently not possible to tell glanceclient the exact
number of images we want, which basically means that it'll *always* go
through the whole list of images in the server unless the limit is
implemented by the consumer.
DocImpact
Change-Id: I9f65a40d4eafda6320e5c7d94d03fcd1bbc93e33
Closes-bug: #1415035
For example:
$ glance --os-image-api-version 2 image-create < /tmp/data
This is consistent with v1.
DocImpact
Closes-bug: 1408033
Change-Id: Ifed4ece9e4e02a46d80b49a8e4fc372f1a304241
Help for 'v2 image create --file' should refer to upload,
not download.
DocImpact
Change-Id: I2ae00e3242fb10001e216cde93fdf9c6f18ad13e
Closes-bug: 1408028
Previously, running:
cat something.img | glance image-create --progress --container-format=bare --disk-format=raw
or
cat something.img | glance --os-image-api-version 2 image-upload --progress <image id>
would result in an error. This error was caused by the length of the
input being unknown, so the overall progress cannot be found.
This patch disables the progress bar whenever the size of the input file
cannot be determined.
Change-Id: I6bfef7441864b638194126880241cc2c96d5b18b
Closes-Bug: #1402746
any is both idiomatic and easier to read. There's no performance difference
because both will stop as soon as a matching value is found.
Change-Id: Ia527d96844015085cc289869a3c4d2722db1043c
Allows passing --file and --progress to glance image-create with Image API v2.
if --file is present the image-create effectively calls image-upload with the
newly created image's id and the '--file' + '--progress' paramaters. The image
metadata will be printed after the upload call instead of after creation.
In a case argumented file does not exist the image will not be created and
error will be printed instead.
DocImpact
Closes-Bug: #1324067
Change-Id: I5d41fb2bbeb4e56213ae8696b84bf96b749414f8