[openstack-dev] [all][dev][python] constructing a deterministic representation of a python data structure
Davanum Srinivas
davanum at gmail.com
Thu Nov 3 21:22:42 UTC 2016
Amrith,
Please see the older work from 2013:
https://blueprints.launchpad.net/oslo.messaging/+spec/trusted-messaging
https://etherpad.openstack.org/p/HavanaOsloMessaging
https://blog-nkinder.rhcloud.com/?p=62
https://adam.younglogic.com/2014/04/pki-for-oslo-messaging/
-- Dims
On Thu, Nov 3, 2016 at 3:35 PM, Amrith Kumar <amrith at tesora.com> wrote:
> Dims, I don't think ovo addresses this issue. It isn't one of versioning that I'm attempting to address but rather as Gordon points out, of signing and verifying authenticity. Please see also my longer response to him on this.
>
> -amrith
>
> -----Original Message-----
> From: Davanum Srinivas [mailto:davanum at gmail.com]
> Sent: Thursday, November 3, 2016 3:03 PM
> To: OpenStack Development Mailing List (not for usage questions) <openstack-dev at lists.openstack.org>
> Subject: Re: [openstack-dev] [all][dev][python] constructing a deterministic representation of a python data structure
>
> Does oslo.versionedobjects solve some of your needs?
>
> http://www.slideshare.net/davanum/ovo-deep-dive
> https://gorka.eguileor.com/learning-something-new-about-oslo-versioned-objects/
> http://www.danplanet.com/blog/2015/10/06/upgrades-in-nova-objects/
>
> -- Dims
>
> On Thu, Nov 3, 2016 at 2:24 PM, Amrith Kumar <amrith at tesora.com> wrote:
>> TL;DR
>>
>>
>>
>> I want to take a python data structure (see later for details) and
>> represent it in a format that will be stable across python versions,
>> and platforms so that I can construct a stable hash. I’m looking for
>> pointers to some best practices on how to do this.
>>
>>
>>
>> The longer version
>>
>>
>>
>> Assume that there’s some function in python that is:
>>
>>
>>
>> def fn(*args, **kwargs):
>>
>> …
>>
>>
>>
>> I’d like to take (args, kwargs) and construct a hash of some
>> representation that is deterministic. Specifically, assume that fn()
>> is a method in the API (oslo.messaging transport …). I’d like to
>> construct the hash on the sender side and on the RPC server side and
>> make sure that the parameters are the same.
>>
>>
>>
>> So, just before calling call() or cast(), I could compute the hash and
>> stuff it into the dictionary that is being sent over, and I can do the
>> same on the receiving side. But since I cannot guarantee that the
>> representation on the receiving side is necessarily identical to the
>> representation on the sending side, I have issues computing the hash.
>>
>>
>>
>> In IRC, jroll suggested json; can one safely assume that json.dumps()
>> is a deterministic representation?
>>
>>
>>
>> Thanks for any pointers and suggestions.
>>
>>
>>
>> -amrith
>>
>>
>> ______________________________________________________________________
>> ____ OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe:
>> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>
>
> --
> Davanum Srinivas :: https://twitter.com/dims
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
--
Davanum Srinivas :: https://twitter.com/dims
More information about the OpenStack-dev
mailing list