Commit Graph

629 Commits

Author SHA1 Message Date
LiuNanke c7fc0d6b1d Change assertTrue(isinstance()) by optimal assert
assertTrue(isinstance(A, B)) or assertEqual(type(A), B) in tests
should be replaced by assertIsInstance(A, B) provided by testtools.


Change-Id: I7135d3b7fe15b16c17b7581e553ce5d289b58f43
Related-bug: #1268480
2016-01-06 17:07:41 +00:00
Jenkins 9a9f334920 Merge "Disable suggestion of v1 help for v2 commands" 2015-12-22 18:34:43 +00:00
Andy Botting 3caeb4504e Fix image-download to stdout on Python 3.x
Glance image-download to stdout fails on Python3 due to sys.stdout.write
not allowing bytes to be written directly.

A good description of the issue is listed at http://bugs.python.org/issue18512

Closes-Bug: #1528083

Change-Id: I2963914e2e0744410267b5735ff77939413916d4
2015-12-22 14:42:15 +11:00
Shuquan Huang 20d298dc7a Replace assertEqual(None, *) with assertIsNone in tests
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: I384fbe8722af07bcaa4e2610384446751a8072bf
Closes-bug: #1280522
2015-12-17 21:56:42 +08:00
Monty Taylor 9bc0018eda Remove broken try/except workaround for old requests
Not only is this code broken on the requests we require on
distro-provided requests, it's not needed anymore. Remove it.

Closes-bug: 1526254

Change-Id: I47a07bf9910f118392785fc20e015f036a2e8a7c
2015-12-15 10:30:04 +00:00
NiallBunting bf67b80dbf Disable suggestion of v1 help for v2 commands
Currently the client suggests 'Run `glance --os-image-api-version 1
help` for v1 help' at the end of every help message. This is could
be confusing for a v2 only command.

Therefore this patch disables it if the command does not exist in v1,
while keeping the message on the 'glance help' results.

Change-Id: I967e9ba35afb8dc40524bd1d13284e684b435f81
Closes-Bug: 1520602
2015-12-09 13:21:17 +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
Jenkins c6ff80ffe2 Merge "Fix Resource.__eq__ mismatch semantics of object equal" 2015-12-04 23:43:32 +00:00
Jenkins e1fa2c4478 Merge "Fix tests for image-create" 2015-12-03 13:34:23 +00:00
Jenkins 618dde4c8e Merge "Fix help for image-create" 2015-12-03 08:24:44 +00:00
Jenkins b36005fd5c Merge "Update set of wanted commands in read-only test" 2015-12-01 15:59:44 +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
Jake Yip d6b0a5726e Fix tests for image-create
image-create unit tests still checks for obsolete v1 params --location
and --copy-from

remove checking of these params

Closes-bug: 1521044

Change-Id: I75ae1a200ab319b7fb818b4ccfe784af5ef8ff88
2015-11-30 14:41:24 +11:00
Rui Chen 7651b596a3 Fix Resource.__eq__ mismatch semantics of object equal
The __eq__ of apiclient.base.Resource will return True,
if the two objects have same id, even if they have different
other attributes value. The behavior is weird and don't
match the semantics of object equal. The objects that have
different value should be different objects.
Fix this issue and add some test cases in this patch.

Change-Id: I24ba39bf90d727116f256de46241746520efbfee
Closes-Bug: #1499369
2015-11-28 18:15:52 +08:00
Jenkins c4cb6a42ef Merge "Fix typo in 'help' in python-glanceclient" 2015-11-27 17:09:28 +00:00
Kyrylo Romanenko 698f53d241 Update set of wanted commands in read-only test
Nowadays Glance supports more subcommands.
Closes-Bug: #1520585

Change-Id: Ic95c26df31dc3bfb4436969e728f7a1a7c50ff0c
2015-11-27 15:58:19 +02:00
Darja Shakhray 8b4f07767b Fix typo in 'help' in python-glanceclient
Fix typo `glance --os-image-api-version 1 helpNone` in help
in python-glanceclient.

Change-Id: I21bd7a7a5809e7c5fca4c8df1275321a9014bc6f
Closes-bug: #1506049
2015-11-27 16:20:14 +03:00
Jenkins 101528ee63 Merge "Ensure that identity token in header is not an unicode string" 2015-11-27 13:09:50 +00:00
Jenkins af91e2cc0c Merge "Remove self from image-create/image-update" 2015-11-23 18:18:18 +00:00
Vincent Untz f65ba82268 Ensure that identity token in header is not an unicode string
We need all the headers to be safe strings so they can be joined
together and not become an unicode string in doing so.

This fixes a bug when creating an image with non-ascii characters in the
name.

This is required for python 2.6 compatibility.

Change-Id: I66ebc27edf4ccd8f903399da58705711c372536d
Closes-Bug: 1448080
2015-11-17 18:14:20 +01:00
Alexey Galkin 0ac91856ca Fix 'test_help' for shell client.
Added new items in 'wanted_commands'.

Related bug: #1508356

Change-Id: I21ca66d51ace18ac58d33d5d542f805150cb8e4f
2015-11-13 13:06:23 +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
Jenkins 4969251288 Merge "Fix the missing help descripiton of "image-create"" 2015-11-09 13:43:04 +00:00
Jenkins fcd9ab5769 Merge "Use common identity parameters fro keystone client" 2015-11-05 14:50:55 +00:00
Jenkins 20c8d674fb Merge "Added reactivate/deactivate image using CLI" 2015-11-03 18:57:22 +00: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
Jenkins 785ced37ae Merge "Add documentation for running the functional tests" 2015-11-02 14:00:17 +00:00
wangxiyuan dfcb468c1d Fix the missing help descripiton of "image-create"
Now, when use "glance help" to show the help message, the description
of 'image-create' is missing.

Change-Id: I748209222c540e0024580dccac850ea465d176b4
Closes-bug: #1510340
2015-10-27 09:20:56 +08:00
Jenkins c0975934c0 Merge "Add translation to v2 shell" 2015-10-22 12:14:18 +00:00
Jenkins b82df59208 Merge "Import i18n functions directly" 2015-10-22 12:13:47 +00:00
Stuart McLaren 8a4cd7916b Add documentation for running the functional tests
Change-Id: I824f6cd2aa988ed1e4025765971161b44993f00a
2015-10-21 13:33:41 +00:00
Monty Taylor 84538d8870 Use clouds.yaml from devstack for functional tests
devstack produces a file called clouds.yaml already with credentials in
it. Rather than producing our own config file to run functional tests,
just consume the clouds.yaml file that's already there.

Closes-Bug: #1507386
Change-Id: I82c071b2cd903b9578d1f2ec515882c815812692
2015-10-21 05:43:26 +09: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
kairat_kushaev 6b9133c9b6 Import i18n functions directly
As stated in i18n guide it is normal to import i18n functions
(_, _LW..)  directly and we can include i18n functions in
hacking exceptions.
Also there is no need to make exceptions for six moves
because pep8 passes correctly without it.

Change-Id: I9c9aa490f1447bb7ae221809df7bc110c27d1336
2015-10-16 11:26:11 +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
Jenkins b88b510d3b Merge "print usage when no argument is specified for python3" 2015-10-14 11:04:16 +00:00
Jenkins 8687b05ea0 Merge "Use the subcomand parsed args instead of the base" 2015-10-14 11:04:06 +00:00
Flavio Percoco 36937bbf63 Use the subcomand parsed args instead of the base
Pass the subcomand's arguments instead of the base ones to the endpoint
creation call when quering the `/versions` endpoint. Passing the wrong
arguments will end in the auth_requirement not being identified and an
error 'Expected Endpoint' will be raised as no endpoint will be gotten
from keystone.

This patch also removes an unnecessary mock in the test code related to
this fix.

Depends-On Iefeb9bc123f8c65fecd0cba585ecd3eb349b23a6
Change-Id: I46088130b9175798e3719e43f48dc474fbc8a251
Closes-bug: #1504058
2015-10-12 17:05:55 +09:00
Jenkins eab2a9da93 Merge "Stop trying to send image_size to the server" 2015-10-11 11:10:35 +00:00
Jenkins 3ec7c8337f Merge "Do not use openstack.common.i18n in glance client" 2015-10-10 18:59:59 +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 d90c7d6896 Merge "Use dictionary literal for dictionary creation" 2015-10-09 21:11:42 +00:00
Zhiqiang Fan a8a7c68990 print usage when no argument is specified for python3
When running just 'glance' under python3, we will get the error:
ERROR: 'Namespace' object has no attribute 'func'

This is because map() is used to decode sys.argv, but under Python3
it returns a map object which is an iterable. Some code later tries
to use this in a boolean context and it will always return True,
even if it's empty.

Change-Id: I2f03e462cb813833b75b9f2de7badd10b10cddff
Closes-Bug: #1295356
2015-10-09 11:03:15 -06:00
Jenkins c567edc2b2 Merge "Added unit tests for 'Unicode support shell client'" 2015-10-09 16:20:37 +00:00
Jenkins 542941cef0 Merge "Fix Typos in comments" 2015-09-30 18:34:02 +00: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