[sdk] issue in update image method

Artem Goncharov artem.goncharov at gmail.com
Wed Nov 18 20:25:43 UTC 2020

You are absolutely right, it's all matter of what you pass as an image. I
guess you have a problem due to mixing of different sdk layers of objects
(use connection.get_image and pass it in connection.image.xxx). This is not
designed to work this way and may really show weird behavior.
You are advised to use directly conn.image.xxx methods. The so called cloud
layer (conn.get_xxx or self._connection) is designed to be a level above
the "proxy" and designed to give a higher level access. Those are generally
either to wrap multiple different operations in a single function or
normalize cloud differences. And it might return not completely compatible
objects (both are interpretation of the image, but not exchangeable). If
you want to use it this way you should pass image.id (image['id']) into
other functions.
I know this is a bit weird, but there are reasons for that.


On Wed, 18 Nov 2020, 21:08 Roman Budnyk, <r.m.budnik at gmail.com> wrote:

> Hello Artem,
> Thanks for the reply.
> Actually, I am doing nothing special. Calling the method from the client
> instance and passing there image name (or id):
> after analyzing sdk code I came to the understanding that the
> update_image_properties method should work as with string representation of
> name (id) of the image or with the instance of the image class (not sure of
> it's name, but it does not matter here, can be received from
> the get_image() method.
> Please let me know if I can give you any additional information on this.
> Appreciate your help.
> ср, 18 лист. 2020 о 21:06 Artem Goncharov <artem.goncharov at gmail.com>
> пише:
>> Hi Roman,
>> Can you please include some code you use to invoke the mentioned function?
>> I assume you might be calling it in the context that we were not
>> expecting.
>> Thanks,
>> Artem
>> ----
>> typed from mobile, auto-correct typos assumed
>> ----
>> On Wed, 18 Nov 2020, 19:55 Roman Budnyk, <r.m.budnik at gmail.com> wrote:
>>> Hello dear developers,
>>> I was trying to update image data by calling method *update_image_properties.
>>> *Each time I was facing the error: TypeError: existing() argument after
>>> ** must be a mapping, not str
>>> I did small research in the source code and found a strange solution.
>>> Could you please check this place in the code:
>>> class BaseImageProxy, method update_image_properties (path
>>> /openstack/_base_proxy.py):
>>> When I changed it to the below - everything works (with name, id or
>>> image instance):
>>> could you please check on your end, why the construction *if image is
>>> None *is using and how can we execute the code *self._connection.get_image(image)
>>> *if None is passing as the argument.
>>> Many thanks!
>>> Regards,
>>> Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20201118/6dcf13d5/attachment.html>

More information about the openstack-discuss mailing list