3c5efdb74eae49e779f59debfc3807c913e4f699
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
Python bindings to the OpenStack Images API ============================================= This is a client library for Glance built on the OpenStack Images API. It provides a Python API (the ``glanceclient`` module) and a command-line tool (``glance``). This library fully supports the v1 Images API, while support for the v2 API is in progress. Development takes place via the usual OpenStack processes as outlined in the `OpenStack wiki <http://wiki.openstack.org/HowToContribute>`_. The master repository is on `GitHub <http://github.com/openstack/python-glanceclient>`_. See release notes and more at `<http://docs.openstack.org/developer/python-glanceclient/>`_.
Description
Languages
Python
99.4%
Shell
0.6%