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.

Regards,
Michael

Reply via email to