Wrong error when CRL missing
When the CRL is missing, some really strange error gets out. Fix the error to something sane.
Also, there's a suspicion a similar error would happen if the CA certificate was missing.
DEBUG:lua:0 (???):Running script turris
line not found
DIE:src/pkgupdate/main.c:65 (main):an error object {
msg: [string "requests"]:277: attempt to call method 'get' (a nil value),
tp: error,
reason: runtime
}
Stack Traceback
===============
(2) C function 'function: 0x1c7dcd0'
(3) upvalue C function 'error'
(4) Lua function '?' at line 50 of chunk '"updater"]'
Local variables:
entrypoint = string: "file:///etc/updater/entry.lua"
tlc = table: 0x1c7e740 {env:table: 0x1c7f0c0, level_check:function: 0x1c7e2c0, tp:context, sec_level:Full (more...)}
ep_uri = table: 0x1c80450 {ok:function: 0x1c7f120, tp:uri, cback:function: 0x1c808a0, callbacks:table: 0x1c81090 (more...)}
ok = boolean: true
tls = string: "-- Do not edit this file. It is the entry point. Edit the user.lua file.\
\
local uci_ok, uci = pcall(require, \"uci\")\
local disable_all = false\
local branch\
local lists\
if uci_ok then\
local cursor = uci.cursor()\
local disable = cursor:get(\"updater\", \"override\", \"disable\")\
if disable == \"true\" then\
-- The user doesn't want the updater to run\
error(\"Updater disabled\") -- TODO: Something less brutal?\
end\
branch = cursor:get(\"updater\", \"override\", \"branch\")\
if branch then\
branch = \"-\" .. branch\
end\
lists = cursor:get(\"updater\", \"pkglists\", \"lists\")\
else\
ERROR(\"UCI library is not available. Not processing user lists.\")\
end\
branch = branch or \"\"\
\
-- Guess what board this is.\
local f = io.open(\"/tmp/sysinfo/model\")\
local base_model\
if f then\
local raw_model = f:read()\
if raw_model then\
if raw_model:match(\"[Oo]mnia\") then\
base_model = \"omnia\"\
elseif raw_model:match(\"[Tt]urris\") then\
base_model = \"turris\"\
end\
end\
f:close()\
end\
\
if base_model then\
-- The distribution script. It contains the repository and bunch of basic packages. The URI is computed based on the branch and the guessed board\
Script(\"turris\", \"https://api.turris.cz/updater-defs/\" .. base_model .. branch .. \".lua\", { security = \"Remote\", verification = \"cert\", ca = \"file:///etc/ssl/updater.pem\", crl = \"file:///tmp/crl.pem\" })\
else\
WARN(\"Failed to guess the board, relying on user-provided scripts\")\
end\
\
-- Some provided by the user\
Script \"user-src\" \"file:///etc/updater/user.lua\" { security = \"Local\" }\
-- Some auto-generated by command line\
Script \"auto-src\" \"file:///etc/updater/auto.lua\" { security = \"Local\" }\
-- Go through user lists and pull them in. Note that this is a temporary solution\
-- with hardcoded URIs\
if uci_ok then\
if type(lists) == \"string\" then\
lists = {lists}\
end\
if type(lists) == \"table\" then\
for _, l in ipairs(lists) do\
-- TODO: Make signatures work\
-- TODO: Make restricted security work\
Script(\"userlist-\" .. l, \"https://api.turris.cz/updater-defs/\" .. l .. \".lua\", { security = \"Remote\", verification = \"cert\", ca = \"file:///etc/ssl/updater.pem\", crl = \"file:///tmp/crl.pem\" })\
end\
end\
end\
"
err = [string "requests"]:277: attempt to call method 'get' (a nil value) {msg:[string "requests"]:277: attempt to call method 'get' (a nil value) (more...)}