Commit 6fe33b95 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

update literal_eval calls to also use json.loads

json has a few things tiny bit different, and the parser in python is stricter than absolutely necessary, so had to update a few spec and test data files


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac284@2441 e5f2f494-b856-4b98-b285-d166d9295462
parent 4b50c1a4
......@@ -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
......@@ -564,7 +564,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": []
},
}
]
}
}
......
......@@ -279,6 +279,7 @@ class TestSecureHTTPRequestHandler(unittest.TestCase):
rcode, reply = self.handler._handle_post_request()
self.assertEqual(http.client.BAD_REQUEST, rcode)
import sys
class MyCommandControl(CommandControl):
def _get_modules_specification(self):
return {}
......
......@@ -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
}
]
......
Supports Markdown
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