From b3c9ac8bce78d522b3b709dabb55e960cde03358 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 28 Oct 2017 17:05:53 +0200 Subject: [PATCH] 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. --- package/gluon-autoupdater/check_site.lua | 2 +- package/gluon-core/check_site.lua | 2 +- package/gluon-mesh-vpn-fastd/check_site.lua | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-autoupdater/check_site.lua b/package/gluon-autoupdater/check_site.lua index a89c172e..2ed17c45 100644 --- a/package/gluon-autoupdater/check_site.lua +++ b/package/gluon-autoupdater/check_site.lua @@ -1,6 +1,6 @@ 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) local prefix = string.format('autoupdater.branches[%q].', k) diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 6a48d2a3..03439328 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -5,7 +5,7 @@ need_string_match(in_site('site_seed'), '^' .. ('%x'):rep(64) .. '$') if need_table('opkg', nil, false) then 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 assert_uci_name(k, conf_name) diff --git a/package/gluon-mesh-vpn-fastd/check_site.lua b/package/gluon-mesh-vpn-fastd/check_site.lua index 2f846b7c..f2abf83c 100644 --- a/package/gluon-mesh-vpn-fastd/check_site.lua +++ b/package/gluon-mesh-vpn-fastd/check_site.lua @@ -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) local function check_peer(prefix) - return function(k, _, conf_name) + return function(k, conf_name) assert_uci_name(k, conf_name) local table = string.format('%s[%q].', prefix, k) @@ -16,7 +16,7 @@ local function check_peer(prefix) end local function check_group(prefix) - return function(k, _, conf_name) + return function(k, conf_name) assert_uci_name(k, conf_name) local table = string.format('%s[%q].', prefix, k)