On Thu, Feb 06, 2014 at 11:21:13AM +0100, Santi Raffa wrote:
> On Thu, Feb 6, 2014 at 10:20 AM, Jose A. Lopes <[email protected]> wrote:
> >> These functions get passed to the JSON library and they are used
> >> whenever they don't know what to do with an object; in this case, they
> >> instruct the library to use None for Private values. For things that
> >> are not Private, we still don't know how to deal with them. That's why
> >> the generic exception is raised.
> >
> > Doesn't the exception message get shown to the user?
> 
> The message is precisely the same exception that is shown to users
> today. See the documentation
> (http://simplejson.readthedocs.org/en/latest/#simplejson.dump) and the
> actual implementation:
> 
> >>> import simplejson
> >>> simplejson.dumps(simplejson)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line
> 321, in dumps
>     return _default_encoder.encode(obj)
>   File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line
> 237, in encode
>     chunks = self.iterencode(o, _one_shot=True)
>   File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line
> 311, in iterencode
>     return _iterencode(o, 0)
>   File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line
> 213, in default
>     raise TypeError(repr(o) + " is not JSON serializable")
> TypeError: <module 'simplejson' from
> '/usr/lib/python2.7/dist-packages/simplejson/__init__.pyc'> is not
> JSON serializable
> 
> ~~~
> 
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index f300981..6af388d 100644
> 
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -4751,6 +4751,14 @@ glusterPortDefault :: Int
>  glusterPortDefault = 24007
> 
>  -- | Parameters that should be protected
> +--
> +-- Python does not have a type system and can't automatically infer what 
> should
> +-- be the resulting type of a JSON request. As a result, it must rely on this
> +-- list of parameter names to protect values correctly.
> +--
> +-- Names ending in _cluster will be treated as dicts of dicts of
> private values.
> +-- Otherwise they are considered dicts of private values.
> +

Unnecessary newline here.

Rest LGTM.

Thanks,
Jose

>  privateParametersBlacklist :: [String]
>  privateParametersBlacklist = [ "osparams_private"
>                               , "osparams_secret"
> diff --git a/lib/serializer.py b/lib/serializer.py
> index 38bed4f..3371239 100644
> --- a/lib/serializer.py
> +++ b/lib/serializer.py
> @@ -87,6 +87,7 @@ def WrapPrivateValues(json):
>    """Crawl a JSON decoded structure for private values and wrap them.
> 
>    @param json: the json-decoded value to protect.
> +
>    """
> 
>    # This function used to be recursive. I use this list to avoid actual
> 
> 
> -- 
> Raffa Santi
> Google Germany GmbH
> Dienerstr. 12
> 80331 München
> 
> 
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores

-- 
Jose Antonio Lopes
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to