scripts: check_site_lib: need_table() now merges all keys before calling subcheck(...)

This also introduces an api change to the subcheck()!

Before:
-> subcheck(key, value, conf_name)

After:
-> subcheck(key, conf_name)

The idea is, that it's hard to submit a value, which should be then checked
again. It's wouldn't be clear (after merging) from which config the value
is, and so an helpful error message would be impossible.
This commit is contained in:
lemoer 2017-10-28 17:05:53 +02:00
parent 387bf99ab3
commit b3c9ac8bce
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
need_string(in_site('autoupdater.branch')) need_string(in_site('autoupdater.branch'))
local function check_branch(k, _, conf_name) local function check_branch(k, conf_name)
assert_uci_name(k, conf_name) assert_uci_name(k, conf_name)
local prefix = string.format('autoupdater.branches[%q].', k) local prefix = string.format('autoupdater.branches[%q].', k)

View File

@ -5,7 +5,7 @@ need_string_match(in_site('site_seed'), '^' .. ('%x'):rep(64) .. '$')
if need_table('opkg', nil, false) then if need_table('opkg', nil, false) then
need_string('opkg.lede', false) need_string('opkg.lede', false)
function check_repo(k, _, conf_name) function check_repo(k, conf_name)
-- this is not actually a uci name, but using the same naming rules here is fine -- this is not actually a uci name, but using the same naming rules here is fine
assert_uci_name(k, conf_name) assert_uci_name(k, conf_name)

View File

@ -5,7 +5,7 @@ need_boolean(in_site('mesh_vpn.fastd.configurable'), false)
need_one_of(in_site('mesh_vpn.fastd.syslog_level'), {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false) need_one_of(in_site('mesh_vpn.fastd.syslog_level'), {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
local function check_peer(prefix) local function check_peer(prefix)
return function(k, _, conf_name) return function(k, conf_name)
assert_uci_name(k, conf_name) assert_uci_name(k, conf_name)
local table = string.format('%s[%q].', prefix, k) local table = string.format('%s[%q].', prefix, k)
@ -16,7 +16,7 @@ local function check_peer(prefix)
end end
local function check_group(prefix) local function check_group(prefix)
return function(k, _, conf_name) return function(k, conf_name)
assert_uci_name(k, conf_name) assert_uci_name(k, conf_name)
local table = string.format('%s[%q].', prefix, k) local table = string.format('%s[%q].', prefix, k)