Commit Graph

185 Commits

Author SHA1 Message Date
Ihar Hrachyshka 3a0007a1c3 Fixed grammar in image-download command description
Change-Id: Ie18e1bee3376fdc01685c6f1d3a949c6934296b3
2016-06-01 10:07:47 +00:00
Jenkins 9ffebbb25e Merge "Enable hacking checks" 2016-04-20 17:13:16 +00:00
Tin Lam cd5925bc60 Enable hacking checks
Enabled following hacking checks from tox.ini:
- H233 Python 3.x incompatible use of print operator
- H303 no wildcard import
- H404 multi line docstring should start with a summary

Change-Id: I2553bcd3e80c00acc08d135a1d2dadfb6cda49fe
Partial-Bugs: #1475054
2016-04-18 16:23:59 +00:00
Dao Cong Tien 9faa9d47aa Fix typos in docstrings and comments
Update a comment to be more meaningful

Change-Id: Ie1aa46917c1a253db92a0dc819803a1d3e795b07
2016-04-11 09:08:02 +07:00
Jenkins 04e1ea73a5 Merge "Ship the default metadata schema in the client" 2016-03-24 18:35:28 +00:00
wangxiyuan d3de9ed16a Ship the default metadata schema in the client
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
2016-03-24 09:04:20 +00:00
Tom Cocozzello c6904d0332 Docs are generated incorrectly
When docs are generated with pbr command 'warnerrors = True'
there are many doc problems that are shown. This patch fixes
these problems.

Change-Id: Idb804ab924782b6d7d379494987bdba2acbce568
Closes-Bug: #1557235
2016-03-22 13:28:14 +00:00
Jenkins d59e341a4c Merge "Fix location update" 2016-03-11 22:52:56 +00:00
Fei Long Wang 8b6dbb2065 Fix location update
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
2016-03-11 12:51:13 +00:00
Danny Al-Gaaf 860908c517 Catch InUseByStore case in do_image_delete
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>
2016-03-09 23:27:02 +01:00
Jenkins 6aaa6f2f8c Merge "Handle 403 forbidden on download" 2016-02-29 13:04:08 +00:00
Stuart McLaren 5b9f21b38b Handle 403 forbidden on download
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
2016-02-24 18:31:38 +00:00
Jenkins c58b4cc984 Merge "Auto-generated squash commit" 2016-02-12 00:10:58 +00:00
Flavio Percoco e91d8ec4b8 Auto-generated squash commit
Fix misspellings

Upstream-Change-Id: Ie7ecbe4b33dd0e1ef94b0be85ec3af790cc6fcd7

Correct spelling mistake

Change interable to iterable.

Upstream-Change-Id: I468a87a3df9ed00ed82f1ba0d6abbbc6944cf613

Change-Id: I4de8426cd19ef0bc7c00fe57f8bc3303d0a4f8a4
Co-Authored-by: venkatamahesh <venkatamaheshkotha@gmail.com>
Co-Authored-by: Irina <yuyuesh@cn.ibm.com>
2016-02-11 12:26:55 -04:30
Jenkins 7f9c6d62a5 Merge "v2 - "readOnly" key should be used in schemas" 2016-02-08 10:16:32 +00:00
zwei 22e3bf0234 v2 - "readOnly" key should be used in schemas
If it has a value of boolean true,
    this keyword indicates that the instance property SHOULD NOT be changed,
    and attempts by a user agent to modify the value of this property are expected to be rejected by a server.
    The value of this keyword MUST be a boolean.
    The default value is false.

    Further link for reference: http://json-schema.org/latest/json-schema-hypermedia.html#anchor15

Closes-Bug: #1521581
Depends-On: I279fba4099667d193609a31259057b897380d6f0
Change-Id: I96717506259c0d28500b8747369c47029b1dd9b6
2016-02-04 15:06:13 +08:00
kairat_kushaev 56c27d1cb8 Change metavar for location commands in V2
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
2016-01-20 12:04:29 +03:00
Jenkins ab234553cf Merge "Add help the ability to sort images with multiple keys" 2016-01-18 23:23:33 +00:00
kairat_kushaev a8d7ded8fb Enhance description of instance-uuid option for image-create
Current description of instance-uuid may confuse users because
they may think that instance-uuid can serve as basis for image
but it just stores instance-uuid as image-metadata.
So we need to enhance the description in glanceclient.

Change-Id: I55829d106c9d25374df6538b3071104ee5f215f2
Closes-Bug: #1496822
2016-01-18 12:41:17 +03:00
Jenkins 0b7a6d2379 Merge "Remove location check from V2 client" 2016-01-15 05:27:21 +00:00
kairat_kushaev cea67763c9 Remove location check from V2 client
Glance client has a custom check that generates exception if
location has not been returned by image-get request.
This check should on server side and it should be managed by
policy rules when do location-add action.
That also allows to increase possibility of migrating Heat
to v2[1].

NOTE: After this patch, we'll raise a HTTPBadRequest from
server side instead of HTTPConflict when a user adds a
duplicate location.

[1]: https://review.openstack.org/#/c/240450/

Co-Authored-By: wangxiyuan <wangxiyuan@huawei.com>

Change-Id: I778ad2a97805b4d85eb0430c603c27a0a1c148e0
Closes-bug: #1493026
2016-01-15 01:24:48 +00:00
Jenkins 2db882c41c Merge "Add docker to image_schema on glance v2 cli" 2016-01-14 15:24:07 +00:00
Nicolas Simonds 214dbffc92 Skip schema validation on GET /v2/images/%s
These are server-generated, not user-generated, and schema validation
should not be necessary.

Rework a unit test that enforces this; bad data should be blocked
at ingest, not blocked on reads.

Co-authored-by: Stuart McLaren <stuart.mclaren@hp.com>
Change-Id: Ib1926fec0e858b6eed43c7931a6d6c3a1708e70e
Closes-Bug: 1501046
2016-01-12 11:30:52 +00:00
KATO Tomoyuki a74a3648ec Add help the ability to sort images with multiple keys
Related Change: If79779a4c52c8dc5c4f39192d3d247335a76ba24
This help is also used for OpenStack Command-Line Interface Reference.

Change-Id: Iadce779afebe4aa80026e46f169546aba9055477
Partial-Bug: #1432813
2016-01-04 23:17:41 +09:00
Atsushi SAKAI f7b50c48ef Add docker to image_schema on glance v2 cli
Add docker to v2 image_schema
Add docker to v2 unit tests

This is related to following glance api extension.
  https://review.openstack.org/#/c/249282/

Co-Authored-By: Kairat Kushaev <kkushaev@mirantis.com>

Closes-Bug: #1519402
Change-Id: Ia015f027788b49c1b0002fb3e3a93ac825854596
2015-12-25 12:28:55 +00:00
Long Quan Sha 44d0b02c67 Fix the download error when the image locations are blank
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
2015-12-07 16:45:01 +00:00
Jake Yip 255b10df28 Fix help for image-create
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
2015-11-30 16:10:43 +00:00
Jenkins af91e2cc0c Merge "Remove self from image-create/image-update" 2015-11-23 18:18:18 +00:00
wangxiyuan 1f1934eb82 Add versions list function
This patch add a function to query the Glance API versions.

DocImpact

Change-Id: I21eeaee3db4ae23f608b68bb319772ac612975b4
Closes-bug: #1511180
2015-11-10 10:28:32 +08:00
Darja Shakhray bff356ed73 Added reactivate/deactivate image using CLI
Added commands 'glance image-reactivate image_id'
and 'glance image-deactivate image_id' for
reactivate/deactivate image using CLI

DocImpact

Change-Id: I2c370c6bf6ff664d94d756cc76aaa983fbdb8869
Closes-bug: #1508356
2015-11-02 14:00:38 +00:00
kairat_kushaev 4fb3092cb0 Add translation to v2 shell
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
2015-10-16 11:26:15 +03:00
Jenkins 2fcff11b90 Merge "Add support for setting Accept-Language header" 2015-10-14 15:25:03 +00:00
Jenkins ccc7d4e550 Merge "Support image deletion in batches in v2" 2015-10-14 15:04:12 +00:00
Frode Nordahl ca050ed4c1 Add support for setting Accept-Language header
DocImpact

Closes-Bug: 1480529
Change-Id: I35a37d55edb700a5993bd5cc352335a87a15e47a
2015-10-14 12:57:07 +00:00
Monty Taylor afd1810c12 Stop trying to send image_size to the server
It turns out the server does not support this, and the underlying
code gets very unhappy.

Co-Authored-By:Itisha <ishadewan07@gmail.com>
Change-Id: If67c11da28adbb2d793430d122e3930cc278737f
2015-10-10 12:59:53 +00:00
wangxiyuan bf02b048bf Support image deletion in batches in v2
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
2015-10-10 10:18:02 +08:00
Jenkins 8c0c3c9ed4 Merge "Replace exception_to_str with oslo.utils function" 2015-09-30 18:10:40 +00:00
NiallBunting b396e73e73 Remove self from image-create/image-update
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
2015-09-30 10:19:16 +00:00
Jenkins 6e7c64bd5b Merge "Add period in help message" 2015-09-25 16:48:54 +00:00
kairat_kushaev c6addc722c Replace exception_to_str with oslo.utils function
The oslo.utils function has exception_to_unicode that can
replace glance util function exception_to_str.
So we don't to have this exception_to_str function in glance
anymore.

Change-Id: I332bc55558087920fdd6ae2d822bece5166f5ba6
2015-09-22 15:40:02 +03:00
Atsushi SAKAI 05cd0c7508 Add period in help message
Command help message uses help and CLI-Reference generation.
  and in convention, help message stops with period ".".

Change-Id: I652afdb5e4d69a0476a0a2dc313ae60ece3b7bbc
2015-09-19 17:27:14 +00:00
Flavio Percoco b8a881f5ea Don't get the image before deleting it
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
2015-09-16 09:34:34 +00:00
Jenkins d39b5864a3 Merge "Fix the remove property logic in V2" 2015-09-14 08:19:22 +00:00
Jake Yip c8c8964ddd Updates default --sort behaviour
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
2015-09-09 22:44:08 +10:00
Cindy Pallares 0869196ca2 Fix the remove property logic in V2
The check used to verify if there are any properties to remove in the V2
image-update command will always execute even if there are no properties to
remove due to the fact that it checks if remove_prop is not None, when it is
actually a list and not a None value.

Closes-Bug: #1475053
Change-Id: Ia36e945b880de3514c73073a392bdb7dde13cf84
2015-09-02 12:20:23 -05:00
Jenkins dffd67c1c6 Merge "Add more information show in v2" 2015-08-26 11:24:13 +00:00
Jenkins 17375a422c Merge "V2: Do not validate image schema when listing" 2015-08-20 17:28:21 +00:00
wangxiyuan 14be6072e5 Add more information show in v2
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
2015-08-19 11:40:35 +08:00
Gorka Eguileor 8d118ccedc Require disk and container format on image-create
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
2015-08-14 09:59:17 +02:00
Jenkins 89b2dc58da Merge "Ship the default image schema in the client" 2015-08-12 11:49:45 +00:00