Commit Graph

311 Commits

Author SHA1 Message Date
Jenkins 08aaa468d1 Merge "Remove auth token from http logging" 2014-06-04 18:36:51 +00:00
Jenkins 803eed6083 Merge "Finalize Python3 support" 2014-05-28 16:57:34 +00:00
Tom Leaman 6149e1db31 Remove auth token from http logging
This redacts the X-Auth-Token header value from the logs by replacing
it with '***'.

Change-Id: I6b80cc94d42a44f9db801de78fa23218e6eca0ee
2014-05-27 15:09:06 +00:00
Jenkins 8f89a14c9f Merge "fixed typos found by RETF rules" 2014-05-22 09:05:15 +00:00
Jenkins e9e933145e Merge "Return request ID to callers" 2014-05-20 21:42:11 +00:00
Frederic Lepied 628c541a69 Finalize Python3 support
Set the environment variable PYTHONHASHSEED to 0 to have
predictive tests under Python 3.

Change-Id: Ia15a9383e0f20bd0e4572e9f9b9772f1704dff86
2014-05-20 16:42:10 +02:00
Christian Berendt afcf3a5611 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I70245e5ddf342762eb76d8e2e74b6363767726ef
2014-05-05 10:55:02 +02:00
Dirk Mueller 7bdf2526b7 Remove py3k module
This module is obsolete and has been dropped from oslo-incubator.
Use six instead (which is already done here).

Change-Id: I8e0b49cdfbddcf2d44a601ad06be2e75897905fc
2014-04-28 18:23:46 +02:00
Chris Buccella f0635ecf39 Return request ID to callers
Currently, calls (create, get, etc.) return only the Image to a
caller. In order to log a mapping the request IDs of both glanceclient
and the caller, the x-openstack-request-id header value is needed on
the server side. This change allows that value to be bubbled up and
returned to the caller so that the appropriate logging can occur.
The return_req_id parameter can be set by services that are logging
request IDs. Glance's request ID will then be returned via the
return_req_id parameter.

This is a prerequisite for Log Request ID Mappings nova-spec to
be completed; Change Ib9b820a0feeb0c0e828ed3e4fab8261f8761ba9a

Change I43be05c351f901cee5509c76cff6d69f060c0b3f is an example of
a caller using this.

Implements: blueprint return-req-id
Change-Id: Ia82aa14db5f0e453010514fffb9a25d7b0fc2fd1
2014-04-25 10:26:40 -04:00
Davanum Srinivas 078819cf9e Fix for invalid literal ValueError parsing ipv6 url(s)
Switch to using network_utils for splitting the URL. The code
in oslo-incubator supports ipv6 urls

Change-Id: I76be6173b97eb000319d30b4e9232a5a7c4a5aba
Closes-Bug: #1298137
2014-04-02 21:38:20 -04:00
Davanum Srinivas 58ee451286 Adding network_utils module from oslo-incubator
Needed for fixing bug 1298137

Change-Id: I6803f1af8b0ff036bed634c8aa1cffc52bc508e0
2014-04-02 21:36:10 -04:00
Davanum Srinivas ff0c87eeca Sync with oslo-incubator
Head of oslo-incubator is commit id:
2fd457bf2ccbeb2b84ffb204778b6417cd5405ba

includes a fix for gettextutil.Message handling of deep copy
failures and adding a license header

Change-Id: Ie89de1f95bb6fb9d11058413e682c441c39524f1
2014-04-02 21:30:22 -04:00
Jenkins 59c1103655 Merge "Improve help strings" 2014-03-16 17:16:54 +00:00
Cyril Roelandt 3c16d23293 Sync with Oslo
This will help with porting to Python 3. List of merged commits:

04a1abe59ac39890f57d2eed57d3d1b12bb5d757
12bcdb71ffbe9ee1688beed1f0ddb0c198822682
2cfc1a78d8063cf20083cf7df796d730a576551c
302c7c80b503b8090e8118e45061e8903b5339a9
35dc1d797209f0b22ff3ed3b8a6059961563daee
3b248dd683d83fd564f740ea58565d1bc0bd6cc0
4246ce0f373aa8f8955a99a3b6288a32547d8e80
6650435004af149284f0badb2bb8c89005cc7dab
6d55e26aa379fd043c66d1b7c5bf59a1b4a54632
71c22e9b2fbf04fc91a7343d3de0e0c7f10e3988
84d461e859e4b1eb1a00b9b141df61c37da84d2d
8575d87af49ea276341908f83c8c51db13afca44
885828af2297b20a3f9f8e8f6647f7291f784743
8b2b0b743e84ceed7841cf470afed6a5da8e1d07
9f1e7eb4112067423f845bd99ec52256db1c8bb1
bd5dad97585208ea5e86d636f3dc3b669e361a41
be81d6ba70152e5cdd7e8e9d789b9733c6ff527f
bec3a5eb8157c0c552c6392ccf0da342ffb8da26
c178e567cb48d3bc67dcf06bcbb4c6a97df9f434

Closes-Bug: 1289690
Change-Id: I39fa5e3fa46ffe9448b381ed54759cb4270cc898
2014-03-08 05:06:30 +01:00
Jenkins 9c9b70f0a4 Merge "Python 3: do not use the unicode() function" 2014-03-04 09:18:06 +00:00
Jenkins 4f9fc84118 Merge "Replace file with open, which is Python 3 compatible" 2014-03-04 04:22:07 +00:00
Cyril Roelandt 21c422f730 Python 3: do not use the unicode() function
It is Python2-specific, and should not be used in code intended to be portable.

Change-Id: Ibebef1a7e51a7444538275d22d444c926b8b4dec
Closes-Bug: 1284677
2014-03-03 19:12:39 +01:00
Jenkins 46bf452710 Merge "Only show progress bar for local image files" 2014-02-27 11:55:40 +00:00
Andreas Jaeger 2c53246184 Improve help strings
Make help strings consistent to use "." at end of string.

Fix capitalization of API in one help string.

Change-Id: I7cc5289d881c5e58aad9c69b4668584cdeb0b376
2014-02-26 13:57:58 +01:00
Cyril Roelandt 23ad1d6db7 Python3: define a __next__() method for VerboseIteratorWrapper
In Python 3, __next__() has replaced next(). Also, call the next() function
rather than the next() method.

Closes-Bug: #1281866
Change-Id: I92b44508c9c875f16ad89ef8410d2c38092ab23d
2014-02-20 16:15:43 +01:00
Alex Gaynor d465d60867 Replace file with open, which is Python 3 compatible
Change-Id: I471ae9b372f88a508d4654b1a18c6da90397a828
2014-02-13 06:59:18 -08: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
Jon Bernard 0934b97897 Only show progress bar for local image files
This patch fixes a bug where both 'location' and 'progress' are passed
as command line arguments.  In this case, the 'data' field is not
present in the fields dict and therefore the progress option cannot be
used.  A check is added to make sure the user has specified both a local
image file and the progress flag together.

Change-Id: Ia563139ee8b56d54d480534986e4b619a503fbfc
Closes-Bug: #1259357
2014-01-31 13:54:44 -05:00
Jenkins 238e9fffcc Merge "Using common method 'bool_from_string' from oslo strutils" 2014-01-31 02:38:12 +00:00
Jenkins ff7b588602 Merge "Handle endpoints with versions consistently" 2014-01-24 07:00:38 +00:00
llg8212 e5f6dee95d Using common method 'bool_from_string' from oslo strutils
Using common method 'bool_from_string' from oslo strutils to replace
utils.string_to_bool.

partially implements blueprint common-client-library-2

Change-Id: I23924db3000feadcfe823c6cc979ea9752a13fa9
2014-01-24 10:07:44 +08:00
Jenkins f9c7e3d1cd Merge "server 500 should not be a client error" 2014-01-22 15:59:56 +00:00
Jenkins b6468e0a01 Merge "Allow updating empty created v2 images from v1" 2014-01-22 15:59:55 +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
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
Sean Dague 8e146ca500 server 500 should not be a client error
the client should not log a server 50x response at ERROR level.
It already throws an exception, so the caller can care about what
it wants to do with this. This error will show up regularly in
nova that succeed, and there is no way to disable this message,
which isn't an error from Nova's perspective without turning off
*all* the logs.

Set this to debug instead, because from a caller perspective that's
what you want out of this.

Change-Id: I6d0efb53d1e81adf309f7fa580ec5a8073a811c5
2014-01-19 20:02:42 -05: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
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 02b00b6226 Python 3: use six.iteritems and six.string_types
six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.

six.string_types replaces basestring() in Python 2 and str
in Python 3.

Change-Id: Ia18510d167df35caec83626718010228e2140bc0
2014-01-13 12:15:15 +01:00
Jenkins 47de9cfd89 Merge "Python 3: use six.iteritems() instead of iteritems()" 2014-01-12 14:30:58 +00:00
Jenkins d309da1bb2 Merge "Python3: use six.StringIO rather than StringIO.StringIO" 2014-01-11 17:21:07 +00:00
Jenkins 9dd03ce9ce Merge "Python 3: use six.iteritems() instead of iteritems()" 2014-01-11 04:23:04 +00:00
Jenkins bd78a90391 Merge "Reuse Resource from oslo" 2014-01-11 03:56:05 +00:00
Jenkins 36c3b0f3ce Merge "Sync apiclient and py3kcompat from oslo" 2014-01-11 03:56:04 +00:00
Yassine Lamgarchal 440d155558 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: I1c2f1412c586d5d8e0aa866a28232747056e0ca7
2014-01-10 17:17:43 +01:00
Jenkins c473f19fc9 Merge "Fix glanceclient http.py string formatting error" 2014-01-09 17:50:06 +00:00
Yassine Lamgarchal 2c2fdcbb39 Python 3: use six.iteritems() instead of iteritems()
six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.

Change-Id: Ie5efa65c0a992e8136087a7b78ab8e8ce967326e
2014-01-09 14:52:19 +01:00
Yassine Lamgarchal 627e66b9d8 Python 3: use six.iteritems() instead of iteritems()
Six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.

Change-Id: I12fda5f20d2f4fe8227e45b2fe46b332f63deb97
2014-01-09 13:41:46 +01: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
Andrey Kurilin 3002575c80 Reuse Resource from oslo
In the process of unification of the clients code we should
reuse common functionality from Oslo.

Related to blueprint common-client-library-2

Change-Id: I3d82621cced57ad7bc14a2a40e4bef7522f233da
2014-01-06 16:00:31 +00: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
Andrey Kurilin 0bf7bdd6f2 Sync apiclient and py3kcompat from oslo
In the process of unification of the clients code we should
reuse common functionality from Oslo.

Related to blueprint common-client-library-2

Change-Id: If261bce6f2f7676484594c45970d6dd8e676ca79
2013-12-30 12:20:52 +02: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