Object store set_object_metadata is a bit oddball

Bug #1487150 reported by Terry Howe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
Fix Released
Critical
Everett Toews

Bug Description

Should the set_object_metadata method take name=, container=, metadata=? It is just different than other proxy methods.

Tags: objectstore
Revision history for this message
Brian Curtin (brian.curtin) wrote :

It's a relic of the change from object_store having its own proxy and only operating on fully formed resources. https://review.openstack.org/#/c/188452/ mostly covers it but I need to finish it.

Changed in python-openstacksdk:
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Brian Curtin (brian.curtin)
milestone: none → 1.0
Changed in python-openstacksdk:
status: Confirmed → In Progress
tags: added: objectstore
Revision history for this message
Brian Curtin (brian.curtin) wrote :
Revision history for this message
Everett Toews (everett-toews) wrote :

As defined by Object Store [1] the custom "metadata" is made up of the headers prefixed by X-Object-Meta-

I think the get_object_metadata and set_object_metadata should only operate on those headers as there are specific props for all of the other headers. It would be best to include a new prop on obj similar to the one on server

    #: Metadata stored for this obj. *Type: dict*
    metadata = resource.prop('metadata', type=dict)

That strips X-Object-Meta- on get and adds X-Object-Meta- on set to make handling that transparent to the user.

[1] http://developer.openstack.org/api-ref-objectstorage-v1.html#updateObjectMeta

Revision history for this message
Everett Toews (everett-toews) wrote :

Okay well

    metadata = resource.prop('metadata', type=dict)

wouldn't work because metadata on objects is a collection of headers but the point is that the metadata attribute on obj would just be a simple dict.

Revision history for this message
Brian Curtin (brian.curtin) wrote :

get/set have to be able to operate on those header props just like every other, e.g., create_blah(x=1, y=2), does. Those X-Object-Meta- ones are an additional wrench thrown in this that we can solve later, but you should be able to do set_object_metadata(some_object, delete_at=some_datetime) and have it work.

Changed in python-openstacksdk:
assignee: Brian Curtin (brian.curtin) → Everett Toews (everett-toews)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstacksdk (master)

Fix proposed to branch: master
Review: https://review.openstack.org/275441

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstacksdk (master)

Reviewed: https://review.openstack.org/275441
Committed: https://git.openstack.org/cgit/openstack/python-openstacksdk/commit/?id=4ae0638048a572f2fbab71047d4d33e63dc6819a
Submitter: Jenkins
Branch: master

commit 4ae0638048a572f2fbab71047d4d33e63dc6819a
Author: Everett Toews <email address hidden>
Date: Tue Feb 2 17:19:06 2016 -0600

    Make metadata handling consistent in Object Store

    Make metadata handling consistent across all Object Store resources.
    The consistent methods are get_*_metdata, set_*_metadata, and
    delete_*_metadata which is similar to the __get__, __set__, and
    __delete__ methods of a descriptor or the __getitem__, __setitem__,
    and __delitem__ of a MutableMapping so it should be fairly natural
    for Python users.

    Change-Id: Ie6a892b48ac63ef6a6832b66f9e65e1b5d8a6d76
    Closes-Bug: #1487150

Changed in python-openstacksdk:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.