[sdk] issue in update image method

Roman Budnyk r.m.budnik at gmail.com
Wed Nov 18 21:46:59 UTC 2020


Hello Artem,

sorry, looks like I am not following you...
By calling .image I am not receiving methods to work with images, there are
some stuff like:
[image: image.png]
so I am not sure about how to use the image layer directly.
And also from your explanation I do not understand the reason
why update_image_properties() method is not working with the id or name...
I tried to pass here not just image instance, but image['id'], and still
receiving the error in runtime: TypeError: existing() argument after **
must be a mapping, not str

Will be very thankful if you would have a chance to explain this.

Regards,
Roman

ср, 18 лист. 2020 о 22:25 Artem Goncharov <artem.goncharov at gmail.com> пише:

> 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.
>
> Artem
>
> 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/0c58a8a0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 158037 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20201118/0c58a8a0/attachment-0001.png>


More information about the openstack-discuss mailing list