[kea-dev] Check kea configuration

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Thu Mar 19 14:33:14 UTC 2015


Thanks for the suggestion.

Although I believe what Kea use is not strictly JSON: comments are supported.
I don't know if the python json parser allows this. I tried that in perl previously, and had to strip the comments out before calling the parser.


That said, I think also that Kea's parser could be made more lenient.
For example, we could allow one extra comma at the end of a list or an array.

Languages with JSON-like structures, like C and perl, allow this.
I think even Javascript does. (according to: http://www.freeformatter.com/json-validator.html)




-----Message d'origine-----
De : kea-dev-bounces at lists.isc.org [mailto:kea-dev-bounces at lists.isc.org] De la part de Stephen Morris
Envoyé : jeudi 19 mars 2015 13:12
À : kea-dev at lists.isc.org
Objet : Re: [kea-dev] Check kea configuration

On 19/03/15 08:43, Chaigneau, Nicolas wrote:

> I think of this because, from my experience, it is very easy to botch 
> the configuration. (For instance, a comma not removed at the end of a 
> list. I'm doing this quite often.)

Checking the grammar of the file requires the modification to Kea.  To catch syntax errors (such as a missing comma), a simple Python script will help.  Something like:

#!/usr/bin/python
import sys
import json

try:
    f = open(sys.argv[1])
    data = f.read()
    try:
        json.loads(data)
	print("Syntax OK")
    except:
        print("Data was not valid JSON")
except:
    print("Unable to access file " + sys.argv[1])

(Many thanks to StackOverflow for the suggestion.) Admittedly it doesn't tell you where the problem is, but it will tell you if there is a syntax error.

Stephen
_______________________________________________
kea-dev mailing list
kea-dev at lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-dev
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.



More information about the kea-dev mailing list