In Python 3, __next__() has replaced next(). Also, call the next() function
rather than the next() method.
Closes-Bug: #1281866
Change-Id: I92b44508c9c875f16ad89ef8410d2c38092ab23d
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
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
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
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/v1https://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
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
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
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
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
* 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
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
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
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
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
The new line should be writed to stdout only when there is
a progress bar displayed.
Change-Id: If0e62cd5a3734ed67d66d285267c101b7caeea77
Closes-Bug: #1253042
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>
Sync from oslo-incubator contains various python3 fixes.
Change-Id: I55e867450d65d9fa74fd6ef6ffece2bbb9f929cf
Signed-off-by: Chuck Short <chuck.short@canonical.com>