On Thu, Feb 25, 2010 at 11:51, Michael Hanselmann <[email protected]> wrote:
> 2010/2/18 Balazs Lecz <[email protected]>: > > --- a/lib/serializer.py > > +++ b/lib/serializer.py > > @@ -101,11 +101,13 @@ def LoadJson(txt): > > return simplejson.loads(txt) > > > > > > -def DumpSignedJson(data, key, salt=None): > > +def DumpSignedJson(data, key, salt=None, key_selector=None): > > """Serialize a given object and authenticate it. > > > > @param data: the data to serialize > > @param key: shared hmac key > > + @param key_selector: name/id that identifies the key (in case there > are > > + multiple keys in use, e.g. in a multi-cluster environment) > > @return: the string representation of data signed by the hmac key > > > > """ > > @@ -117,6 +119,8 @@ def DumpSignedJson(data, key, salt=None): > > 'salt': salt, > > 'hmac': hmac.new(key, salt + txt, sha1).hexdigest(), > > } > > + if key_selector: > > + signed_dict['key_selector'] = key_selector > > Strings must use "" (not '') in Ganeti. Please provide unittests. > There were only single quotes in /lib/serializer.py, that's why I used that. Shall I replace all single quotes with double quotes in that file? > Regards, > Michael >
