Ask Your Question

Why does glance client return an iterator but expect a file like object?

asked 2011-04-22 23:33:06 -0500

vishvananda gravatar image

I'm a bit lost as to why the client returns an iterator for get but then expects a file like object for add. It would be great if both of these worked the same way. Then it would be possible to do something like:

from glance import client

remote = client.Client('') local = client.Client('localhost')

metadata, image = remote.get_image(42) local.add_image(metadata, image)

It would also be nice if glance sanitized extra metadata in add as well. Even if the add / get were symmetrical, it fails because there are some keys that don't play nicely with add (id for example). The sanitization could be on the server end or a little helper method could theoretically be provided in the client:

metadata = client.santitize(metadata)

but it seems like the server should be smart enough to strip out metadata it can't handle.

I can add these as wishlist bugs, but I wanted to make sure there wasn't some reason that it worked this way before I started throwing things into the bug tracker.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2011-04-29 19:36:16 -0500

jaypipes gravatar image

Converted to 2 bugs.

edit flag offensive delete link more

answered 2011-04-29 19:32:08 -0500

jaypipes gravatar image


OK, answers to both of these questions are pretty straightforward: because nobody has bothered to ask for something different :)

I agree with your assessment on both points and will file wishlist bugs for both.

Cheers! jay

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2011-04-22 23:33:06 -0500

Seen: 31 times

Last updated: Apr 29 '11