Commit e26aaedc authored by Jelte Jansen's avatar Jelte Jansen
Browse files

merge branches/trac284 (Not every 'data' parsing is done with json)

specfiles must now be strict JSON (i.e. no single quotes around strings but double quotes, no comma after the last element of a map or list, and true/false instead of True/False), since the python json parser is more strict than the C++ one.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2541 e5f2f494-b856-4b98-b285-d166d9295462
parents 4b46ebe7 af94c66b
......@@ -5,7 +5,7 @@
"config_data": [
{ "item_name": "database_file",
"item_type": "string",
"item_optional": True,
"item_optional": true,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
}
],
......
......@@ -35,7 +35,7 @@ import os, time, random, re
import getpass
from hashlib import sha1
import csv
import ast
import json
import pwd
import getpass
import traceback
......@@ -568,7 +568,7 @@ class BindCmdInterpreter(Cmd):
else:
parsed_value = None
try:
parsed_value = ast.literal_eval(cmd.params['value'])
parsed_value = json.loads(cmd.params['value'])
except Exception as exc:
# ok could be an unquoted string, interpret as such
parsed_value = cmd.params['value']
......
......@@ -6,20 +6,20 @@
{
"item_name": "key_file",
"item_type": "string",
"item_optional": False,
"item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-keyfile.pem'
"item_optional": false,
"item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-keyfile.pem"
},
{
"item_name": "cert_file",
"item_type": "string",
"item_optional": False,
"item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-certfile.pem'
"item_optional": false,
"item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-certfile.pem"
},
{
"item_name": "accounts_file",
"item_type": "string",
"item_optional": False,
"item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-accounts.csv'
"item_optional": false,
"item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-accounts.csv"
}
],
"commands": [
......@@ -32,7 +32,7 @@
"command_name": "shutdown",
"command_description": "shutdown cmdctl",
"command_args": []
},
}
]
}
}
......
......@@ -17,6 +17,7 @@
import unittest
import socket
import tempfile
import sys
from cmdctl import *
SPEC_FILE_PATH = '..' + os.sep
......
......@@ -6,37 +6,37 @@
{
"item_name": "transfers_in",
"item_type": "integer",
"item_optional": False,
"item_optional": false,
"item_default": 10
}
],
"commands": [
{
'command_name': 'retransfer',
"command_description": 'retransfer a single zone without checking zone serial number',
'command_args': [ {
"command_name": "retransfer",
"command_description": "retransfer a single zone without checking zone serial number",
"command_args": [ {
"item_name": "zone_name",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": ""
},
{
"item_name": "master",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": ""
},
{
"item_name": "port",
"item_type": "integer",
"item_optional": True,
"item_optional": true,
"item_default": 53
},
{
"item_name": "db_file",
"item_type": "string",
"item_optional": True,
"item_default": '@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3'
"item_optional": true,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
}
]
},
......
......@@ -5,43 +5,43 @@
{
"item_name": "transfers_out",
"item_type": "integer",
"item_optional": False,
"item_optional": false,
"item_default": 10
},
{
"item_name": "db_file",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
},
{
"item_name": "log_name",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": "Xfrout"
},
{
"item_name": "log_file",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/log/Xfrout.log"
},
{
"item_name": "log_severity",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": "debug"
},
{
"item_name": "log_versions",
"item_type": "integer",
"item_optional": False,
"item_optional": false,
"item_default": 5
},
{
"item_name": "log_max_bytes",
"item_type": "integer",
"item_optional": False,
"item_optional": false,
"item_default": 1048576
}
],
......
{'TestModule': {'test': 125}, 'version': 1}
{"version": 1, "TestModule": {"test": 125}}
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True },
"value6": { "v61": "bar", "v62": true },
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
{
"value1": "asdf",
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True }
"value6": { "v61": "bar", "v62": true }
}
{
"value1": 1,
"value2": False,
"value3": True,
"value2": false,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True }
"value6": { "v61": "bar", "v62": true }
}
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, "a" ],
"value6": { "v61": "bar", "v62": True }
"value6": { "v61": "bar", "v62": true }
}
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": "Break" }
......
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True },
"value7": [ 1, 2.2, "str", True ],
"value6": { "v61": "bar", "v62": true },
"value7": [ 1, 2.2, "str", true ],
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True },
"value6": { "v61": "bar", "v62": true },
"value8": [ { "a": "d" }, { "a": "e" } ],
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
{
"value1": 1,
"value2": 2.3,
"value3": True,
"value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": True },
"value6": { "v61": "bar", "v62": true },
"value8": [ { "a": "d" }, { "a": 1 } ]
}
......@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "real",
"item_optional": False,
"item_optional": false,
"item_default": 1
}
]
......
......@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "boolean",
"item_optional": False,
"item_optional": false,
"item_default": 1
}
]
......
......@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "string",
"item_optional": False,
"item_optional": false,
"item_default": 1
}
]
......
......@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "list",
"item_optional": False,
"item_optional": false,
"item_default": 1
}
]
......
......@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "map",
"item_optional": False,
"item_optional": false,
"item_default": 1
}
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment