On assertEqual, the order of parameters should be (expected, observed).
But, some part of glanceclient test were written with invalid order.
This patch fixes this problem.
Change-Id: I7722fdce766ce3cc5bc9944dc72d7d0af0b09f69
Partially-bug: #1277104
In Python 3, __next__() has replaced next(). Also, call the next() function
rather than the next() method.
Closes-Bug: #1281866
Change-Id: I92b44508c9c875f16ad89ef8410d2c38092ab23d
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
In Python 3, the generated JSON patches have a different representation than
those generated with Python 2. For instance, the patch generated in
test_patch_should_replace_missing_core_properties() is:
'[{"op": "replace", "value": "red", "path": "/color"}]'
in Python 2, but:
'[{"path": "/color", "value": "red", "op": "replace"}]'
in Python 3. Therefore, the comparison fails, and the test fail. We fix the
tests by comparing JsonPatch objects rather than strings.
Closes-Bug: #1281374
Change-Id: Id435e87664b2d2aa0ba69f2df1c1fad431651963
* tox.ini: The LANG, LANGUAGE and LC_ALL environment overrides were
introduced originally during the testr migration in an attempt to be
conservative about the possibility that locale settings in the
calling environment could cause consistency problems for test runs.
In actuality, this should be unnecessary and any place where it does
cause issues ought to be considered an actual bug. Also, having
these in the configuration actively causes older pip to have
problems with non-ASCII content in some package metadata files under
Python 3, so drop it now.
Change-Id: I6be8e42167191096b16d0f16e8c89e85aeedd74c
Closes-Bug: #1277495
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
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
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
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
* 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