Commit Graph

144 Commits

Author SHA1 Message Date
Cyril Roelandt ecf2868fb3 test_shell: remove a deprecated keyword argument
The 'version' keyword argument of argparse.ArgumentParser is deprecated. It was
set to 'None' anyway, so just remove it.

Closes-Bug: #1281856
Change-Id: I6e5af0d90e9b1e7a6a60d5183c13299101148442
2014-02-19 01:54:08 +01:00
Shane Wang 0cda69f6a5 Fix misspellings in python-glanceclient
Fix misspellings detected by:
* pip install misspellings
* git ls-files | grep -v locale | misspellings -f -

Change-Id: I504521e702c675640ab3869c608fa96edd2477b4
Closes-Bug: #1257295
2014-02-07 13:31:58 +08:00
Edward Hope-Morley 4a41358cea Add support for image size in v2 api upload
Some backend stores e.g. RBD, will fail if told to create an
image without a valid size (RBD will fail to write to a zero-size
image). Here we add support to allow the image size to be provided
when doing an upload. The result is that the upload content-length
will be set if available either from checking the supplied file
object or as provided by user.

Closes-Bug: 1220197
Change-Id: Ia1f2ea5680a139750d931591949b3e0058148b4b
2014-02-03 11:10:50 +00:00
Jenkins ff7b588602 Merge "Handle endpoints with versions consistently" 2014-01-24 07:00:38 +00:00
Jenkins b6468e0a01 Merge "Allow updating empty created v2 images from v1" 2014-01-22 15:59:55 +00:00
Jenkins a801e8731a Merge "It was removed urllib, urllib2 & urlparse modules" 2014-01-22 15:59:53 +00:00
Stuart McLaren ee7fd2f5bd Handle endpoints with versions consistently
When using the cli the Glance client wraps the endpoint in a 'strip
version' function. This means that endpoints of the following forms can
both be used:

https://region-x.images.example.com:443/v1
https://region-x.images.example.com:443

When calling the client library directly (as Ceilometer does) however
only endpoints of the second form work. The cli and library should handle
the two cases consistently.

Addresses bug 1243276.

Change-Id: Ice7b581fee32540a7057ba47433a10166a3caed2
2014-01-22 11:16:58 +00:00
Jenkins f6c3d4e141 Merge "Replace file.write and os.path.exists by mock" 2014-01-22 03:44:07 +00:00
David Koo 3c5efdb74e Allow updating empty created v2 images from v1
When an empty image is created through python-glanceclient using v2 APIs
but updated using v1 APIs, python-glanceclient crashes with a "int()
argument must be a string or a number, not 'NoneType'" message.

This is because v1.images.ImageManager._format_image_meta_for_user
expects the 'size' (and 'min_ram' and 'min_disk') field of an image to
be convertible to 'int' but the server-side v2 APIs set it to 'None' for
an empty image. Therefore the conversion to int fails with the message
above.

This fix modifies _format_image_meta_for_user to check whether or not a
field can be converted to 'int' and, if not, returns 0 (zero) as the
value instead.

Tests have also been added.

Change-Id: I86680bc06c8ce3ee492efeb3f32071da4f293bcd
Closes-bug: #1258160
2014-01-20 09:46:58 +08:00
Victor Morales 29674c3f48 It was removed urllib, urllib2 & urlparse modules
Those modules have been combined in python 3. Therefore,
implementing the six module helps to have support to both versions.

Change-Id: I164a0f19790ff066d16d0cf4f0daa6f1097c848e
Closes-Bug: #1267181
2014-01-18 22:17:57 -06:00
Dirk Mueller e4d1961c92 python3: Switch to mox3 instead of mox
In order to transition to a python 3.x compatible world,
lets switch to mox3 which is python 3.x compatible drop-in
replacement of mox.

Change-Id: Id971475f0e92900689d6784ffc55ae5fe63d9fe4
2014-01-16 14:12:40 +01:00
Noboru arai 869ea2e61c Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I2b37758f9dbb2cad6457a879d4ed7ff0aa69ef8e
Partial-Bug: #1229324
2014-01-14 16:40:22 +00:00
Yassine Lamgarchal ae579aae09 Python3: use six.StringIO rather than StringIO.StringIO
It’s an alias for StringIO.StringIO in Python 2 and
io.StringIO in Python 3.

Change-Id: I5316eaffa2d9d2d5679b85a901933ef0fbfcc2f7
2014-01-10 17:25:45 +01:00
Andrey Kurilin 9a0b7d0450 Replace file.write and os.path.exists by mock
During the test files may be lost in the temporary directory.
Therefore, it would be nice if we reduce dependence of temporary directory.

This patch replace buildin method file.write by mock in ShellCacheSchemaTest.
Also we need to replace method os.path.exists by mock to correct all checks.

Fixes bug: #1267515

Change-Id: I3faca27348e15b28619e49f11d0d6cff5a9e2906
2014-01-10 17:37:00 +02:00
Jenkins c473f19fc9 Merge "Fix glanceclient http.py string formatting error" 2014-01-09 17:50:06 +00:00
Le Tian Ren 2ed01afac9 Fix glanceclient http.py string formatting error
* Fix "TypeError: not all arguments converted during string formatting"

* Add a UT case to cover the path where the bug is in

Change-Id: I91a137c5c3a9a3cc603804bef5eaea14ae281c08
Closes-Bug: #1265730
2014-01-07 16:09:01 +08:00
Fei Long Wang 336feeb523 Get better format for long lines with PrettyTable
Based on current implement, the cli output format will be bad if
the lines are too long. This issue can be fixed by setting 'max_width'.
However, there is a bug against it, see
https://code.google.com/p/prettytable/source/browse/trunk/CHANGELOG?r=85
line 3. So the requirements.txt is updated as well.

docImpact
Fixes bug 1251283

Change-Id: I0d4192ad9d10a3d6d47a8319463a5edb57719a68
2014-01-06 20:48:54 +08:00
Jenkins 14b74573f1 Merge "Fix and enable gating on H306" 2013-12-23 05:10:08 +00:00
Jenkins ac6c0d8742 Merge "Fix extra new line that break from progress bar" 2013-12-20 23:38:10 +00:00
Jenkins e7b7cfe2f3 Merge "Replace inheritance hierarchy with composition" 2013-12-19 18:23:52 +00:00
Dirk Mueller 9f255a9b49 Fix and enable gating on H306
H306 - module imports should be in alphabetical order

Change-Id: I1f8fc25b0e6ca23c21c90bda420f42a45141c2e2
2013-12-16 15:28:05 +01:00
Dominik Heidler 097ca3d53f SSL: Handle wildcards in Subject Alternative Names
Closes-Bug: #1259528

Change-Id: Iedc2b98d47f1f9433a4cfd77e07f7f86bae806c1
2013-12-11 10:27:20 +01:00
Andrey Kurilin 24340329cf Replace inheritance hierarchy with composition
In the process of unification of the clients code we should use
composition to allow easier replacement with common HTTPClient.

Related to blueprint common-client-library-2

Change-Id: I5addc38eb2e2dd0be91b566fda7c0d81787ffa75
2013-12-09 18:50:12 +02:00
m.benchchaoui@cloudbau.de 2dfbb3f57b Fix extra new line that break from progress bar
The new line should be writed to stdout only when there is
a progress bar displayed.

Change-Id: If0e62cd5a3734ed67d66d285267c101b7caeea77
Closes-Bug: #1253042
2013-11-20 22:27:00 +01:00
Jenkins a7c33d5802 Merge "change assertEquals to assertEqual" 2013-11-15 06:33:29 +00:00
Jenkins 9a649d46ea Merge "Replace OpenStack LLC with OpenStack Foundation" 2013-11-15 06:33:28 +00:00
Christian Berendt 7f8292f39d change assertEquals to assertEqual
According to http://docs.python.org/2/library/unittest.html
assertEquals is a deprecated alias of assertEqual.

Change-Id: I22f4702f41537c05684dfacb3f305627b36849c5
2013-10-24 07:54:16 +02:00
Chuck Short 518cb2508d python3: use six.moves for httplib imports
This adds six to the requirements.txt file in order to make
some HTTP-related imports work across Python 2's httplib and Python 3's
http.client modules. Tests were updated, including one change to the
location of HTTPConnection - moving it from being accessed where it was
imported rather than its canonical location inside of
six.moves.http_client.

Change-Id: Ibc4932b37dfdf195cd5091066914513af1876955
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-10-16 10:00:56 -04:00
Jenkins cd11833cff Merge "Fix regression bug after removing posixpath in http.py" 2013-10-09 17:46:01 +00:00
Jenkins 5ec5e7baec Merge "Fix getting header in redirect processing" 2013-10-09 17:36:54 +00:00
Chang Bo Guo 7bf27252e5 Fix misused assertTrue in unit tests
Refactored unit tests to use assertEqual instead of assertTrue
where needed.

Closes-Bug: #1226374

Change-Id: I5f3b582e19f3461a04b5df05960095779ec8aa1a
2013-10-08 19:04:08 -07:00
eddie-sheffield 32d9c42816 Add CLI for V2 image create, update, and upload
Provides command line support for image-create, image-update,
and image-upload using the Glance V2 API. This includes building
help text for create and update based on the image jsonschema
as fetched from the server.

Also fixes bug caused by default warlock patch generation not
matching what Glance expects when updating a core property
which had not originally been set when the image was created.

Related to bp glance-client-v2

Change-Id: I841f9e3d05802f4b794cb6f4849abe03ff0324d9
2013-10-02 13:22:55 -04:00
Yang Yu a0715e966d Fix regression bug after removing posixpath in http.py
After removing posixpath.normpath(url) in http.py, the code has a
regression bug that the url like 'http://example.com:80/test' can
not work. The code urlparse.urljoin() can not work as '%s%s' %
(self.endpoint_path, url).

Fixes bug #1230032

Change-Id: Ie7266fc3a067b92dfeed169086b4bf6a87dedbd6
2013-09-28 21:47:09 -05:00
Russell Bryant 50266eec2b Fix getting header in redirect processing
The code for processing an HTTP redirect included an incorrect method of
getting the Location header from an HTTPResponse.  It needs to use the
getheader() method on the response, instead.  This patch fixes that and
includes a unit test that covers this code path.

Change-Id: I0952fabad581b020dee07bdc4007b55b47c906aa
Closes-Bug: #1231524
2013-09-26 11:45:06 -04:00
Jenkins 7a4a8a0979 Merge "Support glance client can get ipv6 image url correctly" 2013-09-25 20:01:58 +00:00
ZhiQiang Fan 2517203975 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I38dcbcf1a6c8efe540fcf5f29e782cb3826e583d
Fixes-Bug: #1214176
2013-09-20 04:05:51 +08:00
Jenkins 360a29a763 Merge "Use openstack-images-v2.1-json-patch for update method" 2013-09-19 17:55:45 +00:00
Dazhao 061da46202 Support glance client can get ipv6 image url correctly
This patch is for fix bug 1208784. In openstack ipv6 environment,
if the os image url is not provided, need use the provided host
to generate literal ipv6 image url.

Fixes bug 1208784

Change-Id: Icb71241a639db02d079348f086bd7bd5f0412609
2013-09-06 13:58:24 +08:00
Fei Long Wang 897ae3d795 Enable query image by tag
This patch will enable Glance client to query images by user
defined tags.

Implement bp image-query-by-tag
Implement bp glance-client-v2

Change-Id: I6f54630c5b7c9c567d85485ad4289284e5486814
2013-08-28 14:13:27 +08:00
Ghe Rivero 3307549a0f Use openstack-images-v2.1-json-patch for update method
image.patch returns a JSON schema Draft 10 (application/openstack-images-v2.1-json-patch)
while the glaceclient update method specify a Content-Type header
application/openstack-images-v2.0-json-patch with correspond to a JSON schemea Draft 4.

Fixes bug 1206095
Change-Id: I8c5a96f0e117a81b5b527a96ef45758fc69b518d
2013-08-23 06:52:08 +00:00
Jenkins fe9a62b5b5 Merge "Allow single-wildcard SSL common name matching" 2013-08-22 21:12:36 +00:00
Brian Waldon 683e40fd31 Allow single-wildcard SSL common name matching
Fix bug 1212463

Change-Id: I168601fd9847497c2261c77ce6c856bca187c6c8
2013-08-21 17:57:38 +00:00
eddie-sheffield 7e4ba229c3 \Allow removal of properties using glance v2 api
This adds support to the glance client library for removing
properties from an image. Properties to be removed must be
explicitly listed. There is no equivalent of the 'purge_props'
functionality in v1.

Also beefed up testing around create since some of the
functionality is the same as update.

Fixes bug 1206472

Change-Id: I16f4c39cdfc8a0cd07bede600461b7a289fbb080
2013-08-13 14:13:27 -04:00
Jenkins 0c2d2a982d Merge "Cast image_id to string before calling urllib.quote" 2013-08-09 20:34:10 +00:00
Mark J. Washenberger eb47b55dbd Revert 02116565d3
A patch slipped in that modified the default image list limit in a
backwards-incompatible way. This change reverts that patch, but
preserves some of the formatting improvements.

Change-Id: I17ae5024896ca7b1064be66b9e47653e953771d6
2013-08-08 22:31:40 -07:00
mouad benchchaoui 1d7da740b2 Show a pretty progressbar when uploading and downloading an image.
Add a new module that contain generic wrapper for file and iterator, which
are used to wrap image to upload and the request body iterator in upload and
download cases repectively, to show and advance a pretty progress bar when this
laters are consumed, The progress bar is triggered by adding a --progress command
line argument to commands: image-create, image-download or image-update.

Change-Id: I2ba42fd0c58f4fa087adb568ec3f08246cae3759
bug fix: LP#1112309
blueprint: progressbar-when-uploading
2013-08-08 15:40:15 +02:00
Justin Santa Barbara f629692917 Cast image_id to string before calling urllib.quote
We can't pass a string in; see Bug #1178233

Change-Id: I040c667e122d792fdcb47ee172463339068af48c
2013-08-07 11:17:01 -07:00
Jenkins 43e71e3993 Merge "Changes to allow image upload with V2 api" 2013-07-31 19:10:12 +00:00
eddie-sheffield e827c37a05 Changes to allow image upload with V2 api
Related to bp glance-client-v2

Change-Id: I72a1d2825dd5c1ff4890e8be477cb4447d59f136
2013-07-31 12:28:24 -04:00
Jenkins 5c4fb2f7a1 Merge "Fix test assertions & test cases for V2 Shell Unit test" 2013-07-31 15:22:04 +00:00