[kea-dev] Check kea configuration

Stephen Morris stephen at isc.org
Thu Mar 19 12:12:27 UTC 2015


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


More information about the kea-dev mailing list