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

Asked by Vish Ishaya on 2011-04-22

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('glance.provider.com')
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.

Question information

English Edit question
Glance Edit question
No assignee Edit question
Last query:
Last reply:
Jay Pipes (jaypipes) said : #1


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.


Jay Pipes (jaypipes) said : #2

Converted to 2 bugs.