From 0ca88dc140a504f123505438ead598d4e5f02025 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 13 Nov 2019 01:35:44 +1000 Subject: Make the email and web reports similar, reporting the same tests. --- apt-panopticon-report-email.lua | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'apt-panopticon-report-email.lua') diff --git a/apt-panopticon-report-email.lua b/apt-panopticon-report-email.lua index 5651f71..e157dc1 100755 --- a/apt-panopticon-report-email.lua +++ b/apt-panopticon-report-email.lua @@ -83,12 +83,29 @@ local C = function(s) log(-1, "CRITICAL", s) end local faulty = "" local status = function(host, results, typ) local result = "" - local e = results[typ].errors - local w = results[typ].warnings - for i, u in pairs(results[typ]) do - if "table" == type(u) then - e = e + u.errors - w = w + u.warnings + local e = 0 + local w = 0 + if nil ~= results[typ] then + e = results[typ].errors + w = results[typ].warnings + for k, v in pairs(results[typ]) do + if "table" == type(v) then + e = e + v.errors + w = w + v.warnings + end + end + else + for k, v in pairs(results) do + if "table" == type(v) then + for i, u in pairs(v) do + if "table" == type(u) then + if typ == i then + e = e + u.errors + w = w + u.warnings + end + end + end + end end end @@ -146,7 +163,6 @@ local collate = function(host, ip, results) return results end - local mirrors = loadfile("results/mirrors.lua")() local file, e = io.open("results/Report-email.txt", "w+") @@ -173,9 +189,11 @@ if nil == file then C("opening mirrors file - " .. e) else local http = status(k, results, "http") local https = status(k, results, "https") local dns = "[skip]" - local updated = "[skip]" + local protocol = status(k, results, "Protocol") + local sanity = "[skip]" local integrity = "[skip]" - file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Updated: " .. updated .. " Integrity: " .. integrity .. "\n") + local updated = "[skip]" + file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. " Updated: " .. updated .. "\n") end file:write( "==== faulty mirrors: ====\n\n" .. faulty) file:write( "---- END MIRROR-STATUS ----\n\n" .. -- cgit v1.1